How to setup EWS permission to delete items? - outlook-addin

Posting a query to EWS delete an email returns an error: "The specified object was not found in the store., The process failed to get the correct properties"
However, posting the same query from inside an add-in works. All my research point to this being a permission issue. But I have not been able to confirm it. Is there setting that will allow third-party code to move or delete emails?
Here the query to delete an email:
<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:m="http://schemas.microsoft.com/exchange/services/2006/messages" xmlns:t="http://schemas.microsoft.com/exchange/services/2006/types" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Header>
<t:RequestServerVersion Version="Exchange2010_SP2" />
</soap:Header>
<soap:Body>
<m:DeleteItem DeleteType="MoveToDeletedItems" AffectedTaskOccurrences="AllOccurrences" SendMeetingCancellations="SendToAllAndSaveCopy">
<m:ItemIds>
<t:ItemId Id="AAMkADE2NjQyMjVlLWNhY2UtNDNiMS04MzgxLWZiNzEyNzA0NDgwNQBGAAAAAACLt5QBAQ/GRYv+vEXkY5vLBwA6ksGFFTICTbjFW6e9FfRGAAAAAAEMAAA6ksGFFTICTbjFW6e9FfRGAAA//84oAAA=" />
</m:ItemIds>
</m:DeleteItem>
</soap:Body>
</soap:Envelope>

Is there setting that will allow third-party code to move or delete emails?
No it depends on the permissions on the Containing folder or Mailbox, I would suggest you look at security context the Addin is running under. You might also want to try a Soft or HardDelete rather then doing a MoveToDeleteItems.

Related

What are the minimum capabilities for Application Insights to work?

I'm trying to get Application Insights added to an existing project, which only flags the following as capabilities:
<Capability Name="ID_CAP_LOCATION" />
<Capability Name="ID_CAP_NETWORKING" />
<Capability Name="ID_CAP_PHONEDIALER" />
<Capability Name="ID_CAP_MAP" />
I've added the call in my App's constructor to:
WindowsAppInitializer.InitializeAsync();
And of course, I've checked the ApplicationInsights.config file to check the InstrumentationKey matches that shown on my portal.
Do I need to add additional capabilities to allow these to work, as I'm not seeing anything show up on the Azure Portal for the subscription, and I'm not seeing anything in the debug output to suggest that any diagnostics are being attempted to be sent?
The only required capability appears to be ID_CAP_NETWORKING.
One other thing to watch out for; when using the UI to associate with your applciation insights it will add include a schema in the applicationInsights.config file, which stops it working.
So, instead of:
<?xml version="1.0" encoding="utf-8"?>
<ApplicationInsights>
<InstrumentationKey xmlns="http://schemas.microsoft.com/ApplicationInsights/2013/Settings">xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx</InstrumentationKey>
</ApplicationInsights>
It should look more like:
<?xml version="1.0" encoding="utf-8"?>
<ApplicationInsights>
<InstrumentationKey>xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx</InstrumentationKey>
</ApplicationInsights>

Removing Custom Permissions/Actions from a Portlet

I have been able to define custom portlet actions/permissions based on this example in Liferay Plugins SDK
https://github.com/liferay/liferay-plugins/tree/master/portlets/sample-permissions-portlet
I want to know the necessary steps I need to take to remove the custom portlet actions/permissions (not model permissions) from a portlet.
I remember observing that when I re-deploy a portlet with modified custom actions/permissions, the old custom actions/permissions stick around.
I tried deleting the portlet folder from Tomcat's webapps and it was successfully unregistered. But after I deploy the portlet again with the custom actions/permissions removed from the corresponding XML, I can still see the permissions in the Define Permissions of a Role.
I tried clearing permissions setting in Server Administration of Liferay's control panel, but it didn't change anything (it wasn't supposed to).
After re-deploying the portlet with the removed/modified permissions and restarting the server, I still see the custom actions/permissions assigned to the portlet, but when I select the portlet, then I don't see the removed permissions which is what I need.
Does un-deploying a portlet remove all the associated custom actions/permissions from Liferay Portal and the portal's Database?
Or do I need to make separate liferay service calls to do that?
Any inputs in this regard are really appreciated.
Liferay Version: 6.1.2 CE GA3
portlet.properties
include-and-override=portlet-ext.properties
language.bundle=content.Language
resource.actions.configs=resource-actions/default.xml
resource-actions/default.xml
<?xml version="1.0"?>
<!DOCTYPE resource-action-mapping PUBLIC "-//Liferay//DTD Resource Action Mapping 6.2.0//EN" "http://www.liferay.com/dtd/liferay-resource-action-mapping_6_2_0.dtd">
<resource-action-mapping>
<portlet-resource>
<portlet-name>1</portlet-name>
<permissions>
<supports>
<action-key>ADD_SOMETHING</action-key>
<action-key>CONFIGURATION</action-key>
<action-key>VIEW</action-key>
</supports>
<site-member-defaults>
<action-key>VIEW</action-key>
</site-member-defaults>
<guest-defaults>
<action-key>VIEW</action-key>
</guest-defaults>
<guest-unsupported />
</permissions>
</portlet-resource>
</resource-action-mapping>
content/language.properties
action.ADD_SOMETHING=Add Something
portlet.xml
<portlet-app xmlns="http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd" version="2.0">
<portlet>
<portlet-name>1</portlet-name>
<display-name>Sample Permissions</display-name>
<portlet-class>com.liferay.util.bridges.mvc.MVCPortlet</portlet-class>
<init-param>
<name>view-template</name>
<value>/view.jsp</value>
</init-param>
<expiration-cache>0</expiration-cache>
<supports>
<mime-type>text/html</mime-type>
</supports>
<resource-bundle>content.Language</resource-bundle>
<portlet-info>
<title>Sample Permissions</title>
<short-title>Sample Permissions</short-title>
<keywords>Sample Permissions</keywords>
</portlet-info>
<security-role-ref>
<role-name>administrator</role-name>
</security-role-ref>
<security-role-ref>
<role-name>guest</role-name>
</security-role-ref>
<security-role-ref>
<role-name>power-user</role-name>
</security-role-ref>
<security-role-ref>
<role-name>user</role-name>
</security-role-ref>
</portlet>
</portlet-app>
liferay-portlet.xml
<liferay-portlet-app>
<portlet>
<portlet-name>1</portlet-name>
<instanceable>true</instanceable>
</portlet>
<role-mapper>
<role-name>administrator</role-name>
<role-link>Administrator</role-link>
</role-mapper>
<role-mapper>
<role-name>guest</role-name>
<role-link>Guest</role-link>
</role-mapper>
<role-mapper>
<role-name>power-user</role-name>
<role-link>Power User</role-link>
</role-mapper>
<role-mapper>
<role-name>user</role-name>
<role-link>User</role-link>
</role-mapper>
</liferay-portlet-app>
liferay-display.xml
<?xml version="1.0"?>
<!DOCTYPE display PUBLIC "-//Liferay//DTD Display 6.2.0//EN" "http://www.liferay.com/dtd/liferay-display_6_2_0.dtd">
<display>
<category name="category.sample">
<portlet id="1" />
</category>
</display>
liferay-plugin-package.properties
name=Sample Permissions
module-group-id=liferay
module-incremental-version=1
tags=sample
short-description=This plugin shows how to use the permission service from a portlet.
long-description=
change-log=
page-url=http://www.liferay.com
author=Liferay, Inc.
licenses=LGPL
liferay-versions=6.2.0+
portal-dependency-jars=\
jstl-api.jar,\
jstl-impl.jar
portal-dependency-tlds=\
c.tld
web.xml
<?xml version="1.0"?>
<web-app version="2.4" xmlns="http://java.sun.com/xml/ns/j2ee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">
<jsp-config>
<taglib>
<taglib-uri>http://java.sun.com/jsp/jstl/core</taglib-uri>
<taglib-location>/WEB-INF/tld/c.tld</taglib-location>
</taglib>
</jsp-config>
</web-app>
The above code works perfectly and I am able to see the permissions in Define Permissions for role.
What I am looking for is, if I modify ADD_SOMETHING action to ADD_SOMETHING_ELSE or
Remove ADD_SOMETHING action and add a new action key MY_NEW_ACTION,
would the ADD_SOMETHING permission be removed completely from the portal? And if not what are the steps that I need to take to remove the ADD_SOMETHING permission?
Redeploy and Restart the server is enough to ensure these actions?
EDIT:
Based on Prakash's Response
//Ashok - Beanshell Script for ResourceAction Table Service
import com.liferay.portal.model.ResourceAction;
import com.liferay.portal.service.ResourceActionLocalServiceUtil;
import java.util.List;
List resourceList=ResourceActionLocalServiceUtil.getResourceActions(com.liferay.portal.kernel.dao.orm.QueryUtil.ALL_POS, com.liferay.portal.kernel.dao.orm.QueryUtil.ALL_POS);
for (ResourceAction resourceAction:resourceList) {
System.out.println("Resource Name: " + resourceAction.getActionId());
System.out.println("Resource Name: " + resourceAction.getName());
//ResourceActionLocalServiceUtil.deleteResourceAction(giveActionIdHereForDeleting);
}
Permissions are not removed from database for the portlet either when you un-deploy the portlet, or when you restart the server. why?
Because, undeploying a portlet does not necessarily mean the data needs to be removed from the database, the portlet can be redeployed many times. So liferay correctly takes the safe route of keeping the data intact unless it is manually deleted through the database or through some service. And the permissions are considered as data just like you have data stored for your custom asset.
So you can delete the permissions from ResourceAction table by creating some service or through the beanshell scripting panel in control Panel → Server Administration → Scripting → Select Beanshell. You would also need to take care of the bitwiseValue and the permissions already set in the ResourcePermission table.
I would suggest renaming the permission in the ResourceAction table rather than deleting and adding new, it might get complicated.
Hope this helps.

Silverlight accessing WCF serivce throws Crossdomain error

I understand this question has been answered many times but i could not resolve it for some reason. I hope some one can solve my problem which might be straightforward for many, but i some how couldnt figure it out as I am relatively new to silverlight and web. I have tried all the possible samples available in the internet on cross domain errors but couldnt fix it. I appreciate if any once can help me on this issue i am facing.
I am accessing WCF service from Silverlight 4 client. I have Clientacccesspolicy.xml and Crossdomain.xml in the wwwroot.
I can access my file by using [http://localhost/Remoteapp.html]. But i am getting cross domain error inspite of having the Clientaccesspolicy.xml file in the root, when the application tries to make a webservice call.
In the webdevelopementhelper i can see that the clientaccesspolicy is being requested at the wcfservice port which is [http//localhost:600061/clientaccesspolicy.xml], which is where my service is located and i am getting a 502 response[Connection failed].
When I type [http://localhost/Clientaccesspolicy.xml] in the browser i can locate the file. But silverlight is requesting the policy file at a wrong location.
Every thing works properly in the design time, but when i deploy it to IIS i am getting this error.
Can any one help me how to resolve this issue? Thanks to every one in advance.
Step 1:
check that you have a clientaccesspolicy.xml file or crossdomain.xml file on the WCF service host.
The following clientaccesspolicy.xml
<?xml version="1.0" encoding="utf-8"?>
<access-policy>
<cross-domain-access>
<policy>
<allow-from http-request-headers="SOAPAction">
<domain uri="*"/>
</allow-from>
<grant-to>
<resource path="/" include-subpaths="true"/>
</grant-to>
</policy>
</cross-domain-access>
</access-policy>
A similar crossdomain.xml file would be:
<?xml version="1.0"?>
<!DOCTYPE cross-domain-policy SYSTEM "http://www.macromedia.com/xml/dtds/cross-domain-policy.dtd">
<cross-domain-policy>
<allow-http-request-headers-from domain="*" headers="*"/>
</cross-domain-policy>
if that does not work, try these steps
On the server where the silver light application is deployed , typically in the ClientBin folder of the ASP.NET application, rename the silverlight application file *.xap to *.zip
Extract the contents of the zip file
Edit the ServiceReferences.ClientConfig file
Update the end point address from localhost to the server address where the WCF service is hosted.
Save the file. Zip the contents and rename back to .xap
Step 1: Put crossdomain.xml with the following code into your web service hosting folder.
<?xml version="1.0" ?>
<cross-domain-policy>
<site-control permitted-cross-domain-policies="master-only"/>
<allow-access-from domain="*"/>
<allow-http-request-headers-from domain="*" headers="*"/>
</cross-domain-policy>
Step 2: Put the same file in your silverlight project also when you add reference of above WCF webservice.
Step 3: Update your reference and publish silverlight project.
Try these steps. It will work for sure.
I have also faced the same issue and after a week of my trails got to know that having ClientAcessPolicy.xml and CrossDomainPolicy.xml in the root directory will not serve u r request, the ClientAcessPolicy.xml and CrossDomianPolicy.xml must be sent through the service only.
Follow the below steps to solve this issue
Add a new NameSpace in Iservice1.cs as shown below
[ServiceContract(Namespace = "http://ServiceWCF")]
public interface IPolicyRetriever
{
[OperationContract, WebGet(UriTemplate = "/clientaccesspolicy.xml")]
Stream GetSilverlightPolicy();
[OperationContract, WebGet(UriTemplate = "/crossdomain.xml")]
Stream GetFlashPolicy();
};
Now edit the Service1.svc file with edits,
public class PolicyClass : IPolicyRetriever
{
Stream StringToStream(string result)
{
WebOperationContext.Current.OutgoingResponse.ContentType = "application/xml";
return new MemoryStream(Encoding.UTF8.GetBytes(result));
}
public Stream GetSilverlightPolicy()
{
string result = #"<?xml version=""1.0"" encoding=""utf-8""?>
<access-policy>
<cross-domain-access>
<policy>
<allow-from http-request-headers=""*"">
<domain uri=""*""/>
</allow-from>
<grant-to>
<resource path=""/"" include-subpaths=""true""/>
</grant-to>
</policy>
</cross-domain-access>
</access-policy>";
return StringToStream(result);
}
public Stream GetFlashPolicy()
{
string result = #"<?xml version=""1.0""?>
<!DOCTYPE cross-domain-policySYSTEM""http://www.macromedia.com/xml/dtds/cross-domain-policy.dtd"">
<cross-domain-policy>
<allow-access-from domain=""*"" />
</cross-domain-policy>";
return StringToStream(result);
}
}
Now Add both the file in the Project Location
Better to avoid some of the problems we can add both the file in the Root Folder also
These are some of the changes that have to be made in the Internet Explorer also, after the service is up and running now test in the browser whether the ClientAccesspolicy.xml and Crossdoaminpolicy.xml is accessible from Internet explorer. After all this is done the Microsoft Azure VM link must be added as a trusted site or domain in the browser
First navigate to Internet Explorer-> Internet Options ->Security ->Local Intranet-> Sites
Now check the Check box for Automatically detect intranet network click on Advanced and add the respective Site URL of the VM
Internet Explorer-> Internet Options ->Security ->Trusted Site, add the SP2013 URL which as an added URL
Now in the same window click on the Custom Level Enable all .Net Framework, Active X Controls, Enable .Net Framework Setup
Now move to the advanced Tab and uncheck the Disable the Script Debugging(Internet Explorer), Disable the Script Debugging(others)
In the same Tab we also need to enable some of the options and they are Allow Active Contents from CD's to run on my computer, Allow Active Controls to run in files on my Computer, Enable Native XMLHTTP Support.
After all these are done check weather the Sliverlight application is running properly. For sure if these steps are handles correctly the application will run perfectly.

SOAP request is not correct while sending to SAP PI

I'm consuming a SAP PI Web Service and some reason it's not working. I'm thinking due to incorrect SOAP XML below:
This is what SAP PI is expecting:
<?xml version="1.0" encoding="UTF-8"?>
<ns0:A_Request xmlns:ns0="http://domain.co.au/abc">
<Root>
<Element1>a</Element1>
<Element1>a</Element1>
</Recordset>
</ns0:A_Request>
This is what I'm sending:
<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<A_Request xmlns="http://domain.co.au/abc" xmlns:s="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<Root>
<Element1>a</Element1>
<Element1>a</Element1>
</Recordset>
</A_Request>
Is there any way (programatically or config) that can be done on client side in order to format the XML request as expected by Server?
Or, the it should be fixed in WSDL and client program (my program) will automatically generate the required xml?
Thank you heaps.
You should not manually generate or format the XML sent to the server from the client side. If the server exposes a valid SOAP based service simply point the client to the WSDL and it will generate strongly typed classes that you can use to consume the service. If you are using .NET 3.0 or higher on the client it is recommended that you use the svcutil.exe (or Add Service Reference in VS) to generate those classes. If you are using an older version you could use wsdl.exe (or Add Web Reference in VS).

How to build a simple web proxy in Mule 3?

I ran this Mule 3 file expecting that when I browse to http://localhost:9000, I would be redirected to http://localhost/path (source - behind a login prompt):
<?xml version="1.0" encoding="UTF-8"?>
<mule xmlns="http://www.mulesoft.org/schema/mule/core"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:pattern="http://www.mulesoft.org/schema/mule/pattern"
xsi:schemaLocation="
http://www.mulesoft.org/schema/mule/pattern http://www.mulesoft.org/schema/mule/pattern/3.1/mule-pattern.xsd
http://www.mulesoft.org/schema/mule/core http://www.mulesoft.org/schema/mule/core/3.1/mule.xsd">
<pattern:web-service-proxy
name="WSProxyService"
inboundAddress="http://localhost:9000"
outboundAddress="http://localhost/sugarcrm"/>
</mule>
Instead, I get this unfriendly message from the web browser:
‹mO=OÃ0Ýó+ŽL0KÂÈX‚&ˆJ-DÂŒ×øÀ•ì8rÜJý÷8)bb9éî}Ü{â¢y[©Ï®…µÝ#÷ñ´Y¯ ¿F\·ê±QÍ©‹±}Íe&LtV äÓ÷Ѳ¼)+Øú#kè88xˆö$ðf²Øy}šõ•ü‡›®™¥2Ú÷—Î`h·P üõ›Ç{Dë{²ÆO§Ã7…>8Ì¥áÀIÇùOHƒ´
The web-service-proxy pattern is designed to work with SOAP-style web services. Pointing your browser to it won't do you any good.
For pure HTTP proxying either:
use the new pattern:http-proxy coming in Mule 3.2 and already usable in snapshot builds (examples),
use a pattern:bridge with HTTP in and out endpoints (examples).
The former is a much better option, if you're not snapshot averse, as it has extended support for HTTP requests semantics and an upcoming caching module.
I've had a similar problem, although I used soapUI to perform the test. The solution after some days getting lost is simple, configure soapUI not to use/don't allow compression. What you see is actually compressed answer that server did not mark as compressed.