Create Exchange Message Items with EWS and mark them for deletion - exchange-server

I am using EWS to create items in an Exchange mailbox. I am using the CreateItems method. I am also setting an extended property on the items I create so that it is deleted when that date is reached. The items are created correctly, but they are not deleted at the specified date.
I read that there is a timer job in Exchange that does the actual processing based on the extended property set on an item and that I could use "Start-ManagedFolderAssistant -Identity user#example.com" in Powershell to force that job, but this didn't work either.
Here is the message I am sending:
<?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="Exchange2013" />
</soap:Header>
<soap:Body>
<m:CreateItem MessageDisposition="SaveOnly">
<m:SavedItemFolderId>
<t:DistinguishedFolderId Id="root" />
</m:SavedItemFolderId>
<m:Items>
<t:Message>
<t:ItemClass>IPM.Blabla</t:ItemClass>
<t:Subject>ToDelete</t:Subject>
<t:Body BodyType="Text">Todelete</t:Body>
<t:ExtendedProperty>
<t:ExtendedFieldURI PropertySetId="c11ff724-aa03-4555-9952-8fa248a11c3e"
PropertyName="Expiration Date" PropertyType="String" />
<t:Value>6/4/2015 2:39:04 PM</t:Value>
</t:ExtendedProperty>
</t:Message>
</m:Items>
</m:CreateItem>
</soap:Body>
</soap:Envelope>
Is there something missing with in the message so that the job deletes it? Is there something that I misunderstood in the way the system works?

That property your setting won't do anything it looks like you have pulled the sample from https://msdn.microsoft.com/en-us/library/office/dd633654%28v=exchg.80%29.aspx which is just a sample of creating a custom property for your own use. There is no back-end process that would use this property you just created.
There are two ways of doing expiry in Outlook/Exchange the first is using the PidtagExpirytime https://msdn.microsoft.com/en-us/library/ee237103%28v=exchg.80%29.aspx . This is a client mechanism and there is still no server process to delete the expired messages see http://www.msoutlook.info/question/automatically-delete-message-at-set-date . The Server side method is to stamp the messages with a Retention tag that will specify when the message will be deleted eg http://blogs.msdn.com/b/akashb/archive/2011/08/11/stamping-retention-policy-tag-using-ews-managed-api-1-1-from-powershell-exchange-2010.aspx and in 2013 you can do this via https://msdn.microsoft.com/en-us/library/office/jj220500%28v=exchg.80%29.aspx#ret
Cheers
Glen

Related

Oracle advanced queueing email callback - where is the profit?

Good day!
I can't imagine any benefit from users when they receive an XML via e-mail
from the email notification:
<?xml version="1.0" encoding="UTF-8"?>
<Envelope xmlns="http://ns.oracle.com/AQ/schemas/envelope">
<Body>
<AQXmlNotification xmlns="http://ns.oracle.com/AQ/schemas/access">
<notification_options>
<destination>"MY"."QUEUE1"</destination>
</notification_options>
<message_set>
<message>
<message_header>
<message_id>1111111111111111111</message_id>
<expiration>-1</expiration>
<delay>0</delay>
<priority>1</priority>
<delivery_count>0</delivery_count>
<sender_id>
<protocol>0</protocol>
</sender_id>
<message_state>0</message_state>
</message_header>
</message>
</message_set>
</AQXmlNotification>
</Body>
</Envelope>
Can anyone give me an example or scenario, when this notificatin will be useful?
TIA, Andrew.

NoMeasureSelected CampaignPerformanceReportRequest Microsoft Ads

I'm trying to setup Microsoft ads to a project and get CampaignPerformanceReportRequest working on my project but I'm receiving NoMeasureSelected error. Not sure where the issue is.
I added all the columns mention in the documentation to see if the work, but still getting same error. I tested using add dashboard report. It only require Impression and TimePeriod to generate successful report. I make my request to match the request in dashboard, but still get the same error.
Project is based on Ruby on rails.
<env:Body>
<v13:SubmitGenerateReportRequest xmlns="https://bingads.microsoft.com/Reporting/v13">
<v13:ReportRequest xsi:type="CampaignPerformanceReportRequest">
<v13:ExcludeColumnHeaders>true</v13:ExcludeColumnHeaders>
<v13:ExcludeReportFooter>true</v13:ExcludeReportFooter>
<v13:ExcludeReportHeader>true</v13:ExcludeReportHeader>
<v13:Format>Csv</v13:Format>
<v13:ReportName>Test Report</v13:ReportName>
<v13:ReturnOnlyCompleteData>false</v13:ReturnOnlyCompleteData>
<v13:Aggregation>Summary</v13:Aggregation>
<v13:Columns>
<v13:CampaignPerformanceReportColumn>AccountId</v13:CampaignPerformanceReportColumn>
</v13:Columns>
<v13:Columns>
<v13:CampaignPerformanceReportColumn>CampaignId</v13:CampaignPerformanceReportColumn>
</v13:Columns>
<v13:Columns>
<v13:CampaignPerformanceReportColumn>Keyword</v13:CampaignPerformanceReportColumn>
</v13:Columns>
<v13:Columns>
<v13:CampaignPerformanceReportColumn>KeywordId</v13:CampaignPerformanceReportColumn>
</v13:Columns>
<v13:Columns>
<v13:CampaignPerformanceReportColumn>DeviceType</v13:CampaignPerformanceReportColumn>
</v13:Columns>
<v13:Columns>
<v13:CampaignPerformanceReportColumn>Clicks</v13:CampaignPerformanceReportColumn>
</v13:Columns>
<v13:Filter xsi:nil="true"/>
<v13:Scope>
<v13:AccountIds xmlns:a1="http://schemas.microsoft.com/2003/10/Serialization/Arrays">
<a1:long>[REDACTED]</a1:long>
</v13:AccountIds>
</v13:Scope>
<v13:Time>
<v13:CustomDateRangeEnd>
<v13:Day>30</v13:Day>
<v13:Month>04</v13:Month>
<v13:Year>2022</v13:Year>
</v13:CustomDateRangeEnd>
<v13:CustomDateRangeStart>
<v13:Day>01</v13:Day>
<v13:Month>04</v13:Month>
<v13:Year>2022</v13:Year>
</v13:CustomDateRangeStart>
</v13:Time>
</v13:ReportRequest>
</v13:SubmitGenerateReportRequest>
</env:Body>
Response:
<s:Body>
<s:Fault>
<faultcode>s:Server</faultcode>
<faultstring>Invalid client data. Check the SOAP fault details for more information. TrackingId: 96ad1b6d-26e2-4b60-91d0-b6a68add6140.</faultstring>
<detail>
<ApiFaultDetail xmlns="https://bingads.microsoft.com/Reporting/v13" xmlns:i="http://www.w3.org/2001/XMLSchema-instance">
<TrackingId xmlns="https://adapi.microsoft.com">96ad1b6d-26e2-4b60-91d0-b6a68add6140</TrackingId>
<BatchErrors/>
<OperationErrors>
<OperationError>
<Code>2017</Code>
<Details i:nil="true"/>
<ErrorCode>NoMeasureSelected</ErrorCode>
<Message>The specified report request does not specify measurement columns (at least one is required). Please submit a report request with the required columns for this report type, and optionally additional columns that are to be included in the report.</Message>
</OperationError>
</OperationErrors>
</ApiFaultDetail>
</detail>
</s:Fault>
</s:Body>
Does any one know what is the issue here or any one has working SOAP request ?
Looks like your structure around Columns isn't quite right.
I think what the error The specified report request does not specify measurement columns (at least one is required). Please submit a report request with the required columns for this report type, and optionally additional columns that are to be included in the report. refers to is that Columns should have multiple values (i.e. be an 'array') - not itself be repeated like in your example.
I infer this from the reference documentation where Columns is defined with type ArrayOfCampaignPerformanceReportColumn.
<xs:element name="Columns" nillable="true" type="tns:ArrayOfCampaignPerformanceReportColumn" />
For your example, something like this should work:
<env:Body>
<v13:SubmitGenerateReportRequest xmlns="https://bingads.microsoft.com/Reporting/v13">
<v13:ReportRequest xsi:type="CampaignPerformanceReportRequest">
<v13:ExcludeColumnHeaders>true</v13:ExcludeColumnHeaders>
<v13:ExcludeReportFooter>true</v13:ExcludeReportFooter>
<v13:ExcludeReportHeader>true</v13:ExcludeReportHeader>
<v13:Format>Csv</v13:Format>
<v13:ReportName>Test Report</v13:ReportName>
<v13:ReturnOnlyCompleteData>false</v13:ReturnOnlyCompleteData>
<v13:Aggregation>Summary</v13:Aggregation>
<v13:Columns>
<v13:CampaignPerformanceReportColumn>AccountId</v13:CampaignPerformanceReportColumn>
<v13:CampaignPerformanceReportColumn>CampaignId</v13:CampaignPerformanceReportColumn>
<v13:CampaignPerformanceReportColumn>Keyword</v13:CampaignPerformanceReportColumn
<v13:CampaignPerformanceReportColumn>KeywordId</v13:CampaignPerformanceReportColumn>
<v13:CampaignPerformanceReportColumn>DeviceType</v13:CampaignPerformanceReportColumn
<v13:CampaignPerformanceReportColumn>Clicks</v13:CampaignPerformanceReportColumn>
</v13:Columns>
<v13:Filter xsi:nil="true"/>
<v13:Scope>
<v13:AccountIds xmlns:a1="http://schemas.microsoft.com/2003/10/Serialization/Arrays">
<a1:long>[REDACTED]</a1:long>
</v13:AccountIds>
</v13:Scope>
<v13:Time>
<v13:CustomDateRangeEnd>
<v13:Day>30</v13:Day>
<v13:Month>04</v13:Month>
<v13:Year>2022</v13:Year>
</v13:CustomDateRangeEnd>
<v13:CustomDateRangeStart>
<v13:Day>01</v13:Day>
<v13:Month>04</v13:Month>
<v13:Year>2022</v13:Year>
</v13:CustomDateRangeStart>
</v13:Time>
</v13:ReportRequest>
</v13:SubmitGenerateReportRequest>
</env:Body>

How to move property value from Properties file to payload object using spring integration elements

Sample.properties
=================
http.header.amisys.accept.value=arun/vnd.dsths.services-v1+xml
1)Above XSL automatically loaded when my server starts.
2)I have tried <int:enricher> element but it is not helped me.
Sample Code : Below is bit of code I have tried, Can any one suggest me on this.
<int:channel id="PQLegacySecurity-InputChannel" />
<int:chain input-channel="PQLegacySecurity-InputChannel" >
<!-- Split the Search Request Params from Xml -->
<int-xml:xpath-splitter>
<int-xml:xpath-expression expression="//LegacySecurity" namespace map="xmlMessageNamespace" />
</int-xml:xpath-splitter>
<int:enricher >
<int:payload name="testPayload" expression="${http.header.amisys.accept.value}"/>
</int:enricher>
</int:chain>
Actual Payload Object:Below is the xml which does not contain testPayload property.
<?xml version="1.0" encoding="UTF-8"?><LegacySecurity>
<businessArea>%%%%%%</businessArea>
<LegacySystem>%%%%%</LegacySystem>
<LegacyUserID>%%%%%</LegacyUserID>
<LegacyPassword>%%%%%</LegacyPassword>
<OtherLogin/>
<OtherPassword/>
<AddSecurLogin/>
<AddSecurPassword/>
</LegacySecurity>
Expected Payload Object: Below Object contains new element testPayload node which I should able to add
<?xml version="1.0" encoding="UTF-8"?><LegacySecurity>
<businessArea>%%%%%%</businessArea>
<LegacySystem>%%%%%</LegacySystem>
<LegacyUserID>%%%%%</LegacyUserID>
<LegacyPassword>%%%%%</LegacyPassword>
<OtherLogin/>
<OtherPassword/>
**<testPayload>arun/vnd.dsths.services-v1+xml</testPayload>**
<AddSecurLogin/>
<AddSecurPassword/>
</LegacySecurity>
You can use an xslt transformer. Something like the below, though you will need to figure out correct use of the transformer from the spring docs.
Notice you can pass a parameter through to the XSLT
<int-xml:xslt-transformer result-transformer="toDocumentTransformer" result-type="StringResult" xsl-resource="/xslt/addTestPayload.xslt">
<int-xml:xslt-param name="testPayload" value="${http.header.amisys.accept.value}"/>
</int-xml:xslt-transformer>
In the XSLT file, use this to pick up the parameter:
<xsl:param name="testPayload" />
If you have other changes you need to make to the message you can use the same xslt.

Mule - getting primary key back after insert

From the below article, i understand that Mule won't return the auto-generated Primary key after insert statement. Is there any work-around to get the PrimaryKey? I don't prefer going for mybatis as mentioned in this article.
Any help is appreciated!
http://ricston.com/blog/rant-mule-jdbc-transport-introduction-mule-module-mybatis/
try using new DB module availabe in 3.5.0-M4 or wait a few weeks for Mule ESB 3.5.0. Here is a usage example of this new feature:
<?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:db="http://www.mulesoft.org/schema/mule/db"
xsi:schemaLocation="http://www.mulesoft.org/schema/mule/core http://www.mulesoft.org/schema/mule/core/current/mule.xsd
http://www.mulesoft.org/schema/mule/db http://www.mulesoft.org/schema/mule/db/current/mule-db.xsd">
<flow name="insertWithAutoGeneratedKeys">
<inbound-endpoint address="vm://insertWithAutoGeneratedKeys" exchange-pattern="request-response"/>
<db:insert config-ref="dbConfig" autoGeneratedKeys="true" autoGeneratedKeysColumnIndexes="1">
<db:parameterized-query>INSERT INTO PLANET(POSITION, NAME) VALUES (777, 'Mercury')</db:parameterized-query>
</db:insert>
</flow>
Alternative: Use UUIDs for primary key and generate the UUID in Mule before the insert.

XMLA Discover unparse results error (in Mondrian on Windows 7)

I setup Mondrian and it is working fine but I am unable to make it the XMLA provider.
ie., http://localhost:8080/mondrian works fine but http://localhost:8080/mondrian/xmla.jsp returns the below error :-
<SOAP-ENV:Envelope SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
<SOAP-ENV:Header></SOAP-ENV:Header>
<SOAP-ENV:Body>
<SOAP-ENV:Fault>
<faultcode>SOAP-ENV:Server.00HSBE02</faultcode>
<faultstring>XMLA Discover unparse results error</faultstring>
<faultactor>Mondrian</faultactor>
<detail>
<XA:error>
<code>00HSBE02</code>
<desc>The Mondrian XML: In DataSources: In DataSource: Expected <ProviderName> but found <Catalogs>
</desc>
</XA:error>
</detail>
</SOAP-ENV:Fault>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>
Please check your mondrian.properties file or your datasources.xml file, and just add the tag:
<DataSourceName>Provider=Mondrian;DataSource=YourDataSourceName;</DataSourceName>
That's it. Good luck

Resources