Exchange Server changing daily recurrence pattern to weekly? - exchange-server

I have registered an appointment in Outlook 2003 SP3 with recurrence pattern Daily, every workday, no end date.
The data are stored in MS Exchange Server 2010.
If I query Exchange Web Services for that event (some detail info) it returns a weekly occurrence for every Monday..Friday:
<Recurrence>
<WeeklyRecurrence>
<Interval>1</Interval>
<DaysOfWeek>Monday Tuesday Wednesday Thursday Friday</DaysOfWeek>
</WeeklyRecurrence>
<NoEndRecurrence>
<StartDate>2012-12-03+01:00</StartDate>
</NoEndRecurrence>
</Recurrence>
Technically, these are the same days, but I'm storing this in another system and would like an Outlook daily appointment to show up there as a daily appointment too ;-)
Is this a known issue?
Can anything be done to prevent this?
[I can't myself convert "Weekly Mon-Fri" back to "Daily every workday" because that would modify a 'real' "Weekly Mon-Fri" appointment]
Thanks
Jan
Full request:
<soapenv:Envelope
xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:typ="http://schemas.microsoft.com/exchange/services/2006/types"
xmlns:mes="http://schemas.microsoft.com/exchange/services/2006/messages">
<soapenv:Header>
<typ:RequestServerVersion Version="Exchange2007_SP1"/>
<typ:MailboxCulture>en-US</typ:MailboxCulture>
</soapenv:Header>
<soapenv:Body>
<mes:GetItem>
<mes:ItemShape>
<typ:BaseShape>IdOnly</typ:BaseShape>
<typ:BodyType>Text</typ:BodyType>
<typ:AdditionalProperties>
<typ:FieldURI FieldURI="item:Subject" />
<typ:FieldURI FieldURI="item:ReminderIsSet" />
<typ:FieldURI FieldURI="item:ReminderMinutesBeforeStart" />
<typ:FieldURI FieldURI="calendar:Location" />
<typ:FieldURI FieldURI="calendar:IsAllDayEvent" />
<typ:FieldURI FieldURI="calendar:LegacyFreeBusyStatus" />
<typ:FieldURI FieldURI="calendar:Recurrence" />
<typ:FieldURI FieldURI="item:Body"/>
</typ:AdditionalProperties>
</mes:ItemShape>
<mes:ItemIds>
<typ:ItemId Id="AQMkAD[snip]2HQAAAA=="/>
</mes:ItemIds>
</mes:GetItem>
</soapenv:Body>
</soapenv:Envelope>
Full response:
<Envelope>
<Header>
<ServerVersionInfo MajorVersion="14" MinorVersion="0" MajorBuildNumber="722" MinorBuildNumber="0" Version="Exchange2010"/>
</Header>
<Body>
<GetItemResponse>
<ResponseMessages>
<GetItemResponseMessage ResponseClass="Success">
<ResponseCode>NoError</ResponseCode>
<Items>
<CalendarItem>
<ItemId Id="AQMkAD[snip]2HQAAAA==" ChangeKey="DwAAA[snip]ns8Yn"/>
<Subject>Elke werkdag, geen einddatum</Subject>
<Body BodyType="Text"/>
<ReminderIsSet>false</ReminderIsSet>
<ReminderMinutesBeforeStart>15</ReminderMinutesBeforeStart>
<IsAllDayEvent>false</IsAllDayEvent>
<LegacyFreeBusyStatus>Busy</LegacyFreeBusyStatus>
<Location/>
<Recurrence>
<WeeklyRecurrence>
<Interval>1</Interval>
<DaysOfWeek>Monday Tuesday Wednesday Thursday Friday</DaysOfWeek>
</WeeklyRecurrence>
<NoEndRecurrence>
<StartDate>2012-12-03+01:00</StartDate>
</NoEndRecurrence>
</Recurrence>
</CalendarItem>
</Items>
</GetItemResponseMessage>
</ResponseMessages>
</GetItemResponse>
</Body>
</Envelope>

After another hour of digging I found "Daily and Weekly recurrence pattern trouble" on a Microsoft forum stating that it is not possible:
"The only way to define a recurrence pattern for "Every weekday" in EWS is to use WeeklyRecurrencePatternType. DailyPatternType can only be used to define a recurrence where each occurrence happens N day after the previous one.
In other words, there is no way to distinguish the two in EWS."

Related

Need to finding overlapping dates in XML code

I need help finding the overlapping dates in this XML code. I need to make sure that the End date is not less than or equal to the proceeding Start Date.
<Inventory>
<StatusApplicationControl Start="2019-07-18" End="2019-07-18" InvTypeCode="STDX" />
<InvCounts>
<InvCount CountType="2" Count="9" />
</InvCounts>
</Inventory>
<Inventory>
<StatusApplicationControl Start="2019-07-18" End="2019-07-19" InvTypeCode="STDX" />
<InvCounts>
<InvCount CountType="2" Count="8" />
</InvCounts>
</Inventory>
I have tried the following code.
<rule context="Inventory">
<report test="translate(StatusApplicationControl/#Start, '-', '') <= translate(preceding::Inventory/preceding::StatusApplicationControl/#End, '-', '')">The #Start="<value-of select="#Start"/>" and #End="<value-of select="#End"/>" dates are overlaping</report>
</rule>
I expect this message to be printed -
The Start="2019-07-18" is less than or equal to the End="2019-07-18" date
Any help is greatly appreciated!
It looks like the comments are not helping you.
The rule should be:
<rule context="Inventory">
<report
test="translate(StatusApplicationControl/#Start, '-', '')
<=translate(preceding::Inventory[1]/StatusApplicationControl/#End,'-','')"
>The #Start="<value-of select="#Start"/>" and #End="<value-of
select="preceding::Inventory[1]/StatusApplicationControl/#End"
/>" dates are overlaping</report>
</rule>
EDIT
This Schematron
<schema xmlns="http://purl.oclc.org/dsdl/schematron">
<pattern>
<title>Test dates</title>
<rule context="Inventory">
<assert
test="translate(StatusApplicationControl/#Start, '-', '')
> translate(preceding::Inventory[1]/StatusApplicationControl/#End,'-','')"
>The #Start="<value-of
select="StatusApplicationControl/#Start"
/>" and #End="<value-of
select="preceding::Inventory[1]/StatusApplicationControl/#End"
/>" dates are overlaping</assert>
</rule>
</pattern>
</schema>
With this input:
<root>
<Inventory>
<StatusApplicationControl Start="2019-07-18" End="2019-07-18" InvTypeCode="STDX" />
<InvCounts>
<InvCount CountType="2" Count="9" />
</InvCounts>
</Inventory>
<Inventory>
<StatusApplicationControl Start="2019-07-18" End="2019-07-19" InvTypeCode="STDX" />
<InvCounts>
<InvCount CountType="2" Count="8" />
</InvCounts>
</Inventory>
</root>
Output:
Pattern 'Test dates' Failed : The #Start="2019-07-18" and #End="2019-07-18" dates are overlaping.
Check in https://www.liquid-technologies.com/online-schematron-validator
Here is the SchemaTron rule that worked for me. The issue was passing preceding:: to the translate() function. When doing that I got a SchemaTron Exception.
<rule context="Inventory/StatusApplicationControl">
<report test="translate(#Start, '-', '') <= preceding::StatusApplicationControl/translate(#End, '-', '') ">The #Start="<value-of select="#Start"/>" and #End="<value-of select="#End"/>" dates are overlaping</report>
</rule>

Using XPath to select events that do not match other criteria in Windows event logs

I am trying to develop a Xpath 1.0 compatible filter abiding by the limitations as noted in the answer to Using XPath starts-with or contains functions to search Windows event logs that will match events with event id of 4771 as long as they do not have a certain computer name. Here is sample xml for a 4771 event I do not want to match/display in event viewer.
<Event xmlns="http://schemas.microsoft.com/win/2004/08/events/event">
<System>
<Provider Name="Microsoft-Windows-Security-Auditing" Guid="{94849225-5448-4994-A5BA-1E3B0928C30D}" />
<EventID>4771</EventID>
<Version>0</Version>
<Level>0</Level>
<Task>14339</Task>
<Opcode>0</Opcode>
<Keywords>0x8010000000000000</Keywords>
<TimeCreated SystemTime="2017-03-22T20:13:28.105262600Z" />
<EventRecordID>4368371459</EventRecordID>
<Correlation />
<Execution ProcessID="564" ThreadID="1340" />
<Channel>Security</Channel>
<Computer>sample.computer.net</Computer>
<Security />
</System>
<EventData>
<Data Name="TargetUserName">abc$</Data>
<Data Name="TargetSid">S-1-5-21-376469911-3458163162-136990061-477177</Data>
<Data Name="ServiceName">krbtgt/computer.net</Data>
<Data Name="TicketOptions">0x40810010</Data>
<Data Name="Status">0x18</Data>
<Data Name="PreAuthType">2</Data>
<Data Name="IpAddress">::ffff:10.0.0.1</Data>
<Data Name="IpPort">56815</Data>
<Data Name="CertIssuerName" />
<Data Name="CertSerialNumber" />
<Data Name="CertThumbprint" />
</EventData>
</Event>
And here is the unsuccessful filter I have tried. The event is displayed so it is not being properly filtered out, i.e. the targetusername exclusion is not being handled properly.
<QueryList>
<Query Id="0" Path="ForwardedEvents">
<Select Path="ForwardedEvents">*[System[(EventID=4771)]] and *[EventData[Data[#Name='TargetUserName'] and (Data!='abc$')]]</Select>
</Query>
</QueryList>
It appears the (Data!='abc$') portion is being applied to all the Data elements and as long as there is one Data element that does not match the specified value the entire event matches. The intent is that if there is a combination of Data element with a TargetUserName attribute and the value of that element is abc$ then the entire event should not match.
you've correctly understood
*[EventData[Data[#Name='TargetUserName'] and (Data!='abc$')]]
as matching any data element that isn't 'abc$'. What you want is to only consider TargetUserName elements.
*[EventData[Data[#Name='TargetUserName']!='abc$']]
In normal XPath 1.0 environment we can do what you described this way :
*[System/EventID=4771 and EventData/Data[#Name='TargetUserName' and .!='abc$']]
Apparently Windows Event Log's XPath doesn't support any of the following, which left us in a dead-end : ., self::, text(), node(). The closest we can get using XPath might be by assuming that 'TargetUserName', if exists in a given EventData, always appear as the first Data child so we can do as follows :
*[System/EventID=4771 and EventData[Data[1]/#Name='TargetUserName' and Data[1]!='abc$']]

How to extract a node value from an xml in Mule

This is my source xml sample.
<?xml version="1.0" encoding="UTF-8"?>
<XML>
<Meta>
<Status>Success</Status>
<Debug></Debug>
</Meta>
<Result>
<Surveys>
<element id='0'>
<responses>6</responses>
<SurveyType>SS</SurveyType>
<SurveyID>SV_01C7i5l62dnKTel</SurveyID>
<SurveyName>Georgia Dome GS</SurveyName>
<SurveyDescription>Georgia Dome</SurveyDescription>
<SurveyOwnerID>UR_8IZEh6bVlQaF41L</SurveyOwnerID>
<DivisionID>DV_2cmHYrtm8C93T6J</DivisionID>
<SurveyStatus>Active</SurveyStatus>
<SurveyStartDate>0000-00-00 00:00:00</SurveyStartDate>
<SurveyExpirationDate>0000-00-00 00:00:00</SurveyExpirationDate>
<SurveyCreationDate>2014-06-18 15:14:48</SurveyCreationDate>
<CreatorID>UR_8IZEh6bVlQaF41L</CreatorID>
<LastModified>2014-10-24 14:01:23</LastModified>
<LastActivated>2014-06-24 09:39:23</LastActivated>
<GroupName>Analytics</GroupName>
<GroupID>GR_3kMZEX6m1IqqSjP</GroupID>
<UserLastName>Parrott-Sheffer</UserLastName>
<UserFirstName>Brandon</UserFirstName>
</element>
I would like to print a list of all the value that come in the tag - <SurveyID>.
The following is my Mule flow:
</flow>
</flow>
<flow name="testFlow1" doc:name="testFlow1">
<file:inbound-endpoint path="C:\Data\Mule\deploy\out" responseTimeout="10000" doc:name="File"/>
<file:file-to-string-transformer doc:name="File to String"/>
<logger message="*********First Message - ********* #[message.payload.toString()]" level="ERROR" doc:name="Logger"/>
<foreach collection="#[xpath('//XML/Result/Surveys/element')]" doc:name="For Each">
<set-variable doc:name="Variable" value="#[xpath('SurveyID/text()').text]" variableName="id"/>
<logger level="INFO" message="********* The ID is - #[flowVars['id']]" doc:name="Logger"/>
</foreach>
</flow>
But the result I see on the console is -
INFO 2015-01-20 17:03:35,527 [[REST-API].testFlow1.stage1.02]
org.mule.transformer.simple.AddFlowVariableTransformer: Variable with
key "id", not found on message using
"#[xpath('//SurveyID/text()').text]".Since the value was marked optional,
nothing was set on the message for this variable
INFO 2015-01-2017:03:35,527 [[REST-API].testFlow1.stage1.02] org.mule.api.processor.LoggerMessageProcessor: null
I am getting this xml from a third party and I noticed it does not have any namespace information. Can you please help correct my xpath and display the values.
I am using Mule studio 3.5
First of all I need to say your XML is not valid as it doesn't have ending tags as mentioned by Victor
Anyways,if you make it correct then, You can easily get the value of all SurveyID nodes using XPATH3 and splitter
<flow name="testFlow">
<http:listener config-ref="HTTP_InboundRequest" path="/test" doc:name="HTTP"/>
<splitter expression="#[xpath3('//XML/Result/Surveys/element',message.payload,'NODESET')]" doc:name="Splitter"/>
<logger level="INFO" message="#[xpath3('SurveyID')]" doc:name="Logger"/>
</flow>
It will successfully print all the values of SurveyID
I am not familiar with Mule, only with XPath. But
SurveyID/text()
as in
<set-variable doc:name="Variable" value="#[xpath('SurveyID/text()').text]" variableName="id"/>
would be more logical in my opinion, because inside this for loop, it does not make sense to use an expression that starts with //. Let me know if it works.
You should also slightly modifiy the other XPath expression, also removing the //, then the whole should be
<foreach collection="#[xpath('/XML/Result/Surveys/element')]" doc:name="For Each">
<set-variable doc:name="Variable" value="#[xpath('SurveyID/text()').text]" variableName="id"/>
<logger level="INFO" message="#[flowVars['id']]" doc:name="Logger"/>
</foreach>
Finally, I'm not sure why you select text nodes and then write .text. To me, it seems like you are doing the same thing twice. What does
#[xpath('SurveyID').text]
do?
The xpaths you are using should work, although they could be optimized.
The sample xml looks ok too except for the fact that lacks the closing of three elements:
</Surveys>
</Result>
</XML>
My guess is that sometimes it fails for your depending on the input. I do recommend to put a
<logger message="#[message.payload]" level="ERROR" />
right before the foreach and inside the foreach.

How to call Exchange Web Services GetUserAvailabilityRequest when current timezone does not observe daylight savings time?

I am attempting to call GetUserAvailabilityRequest from South Africa Standard Time which does not observe daylight savings time, however, the TimeZone element requires StandardTime and DaylightTime sub-elements which require details about the cutover to or from DST. Omitting these elements results in an error, as does submitting arbitrary data. Does anyone know the proper way to make this call?
More detail based on comments from #jan-doggen. In this example, user is based in South Africa Standard Time
request (with arbitrary ST and DST change date of January 1)
<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:t="http://schemas.microsoft.com/exchange/services/2006/types">
<soap:Body>
<GetUserAvailabilityRequest xmlns="http://schemas.microsoft.com/exchange/services/2006/messages" xmlns:t="http://schemas.microsoft.com/exchange/services/2006/types">
<t:TimeZone xmlns="http://schemas.microsoft.com/exchange/services/2006/types">
<Bias>-120</Bias>
<StandardTime>
<Bias>0</Bias>
<Time>00:00:00</Time>
<DayOrder>1</DayOrder>
<Month>1</Month>
<DayOfWeek>Wednesday</DayOfWeek>
</StandardTime>
<DaylightTime>
<Bias>0</Bias>
<Time>00:00:00</Time>
<DayOrder>1</DayOrder>
<Month>1</Month>
<DayOfWeek>Wednesday</DayOfWeek>
</DaylightTime>
</t:TimeZone>
<MailboxDataArray>
<t:MailboxData>
<t:Email>
<t:Address>test1#domain.com</t:Address>
</t:Email>
<t:AttendeeType>Organizer</t:AttendeeType>
<t:ExcludeConflicts>false</t:ExcludeConflicts>
</t:MailboxData>
<t:MailboxData>
<t:Email>
<t:Address>test2#domain.com</t:Address>
</t:Email>
<t:AttendeeType>Required</t:AttendeeType>
<t:ExcludeConflicts>false</t:ExcludeConflicts>
</t:MailboxData>
</MailboxDataArray>
<t:FreeBusyViewOptions>
<t:TimeWindow>
<t:StartTime>2013-05-13T00:55:11</t:StartTime>
<t:EndTime>2013-05-27T00:55:11</t:EndTime>
</t:TimeWindow>
<t:MergedFreeBusyIntervalInMinutes>15</t:MergedFreeBusyIntervalInMinutes>
<t:RequestedView>FreeBusyMerged</t:RequestedView>
</t:FreeBusyViewOptions>
</GetUserAvailabilityRequest>
</soap:Body>
Response:
<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/">
<s:Body>
<s:Fault>
<faultcode xmlns:a="http://schemas.microsoft.com/exchange/services/2006/types">a:-2146233088</faultcode>
<faultstring xml:lang="en-US">The specified time zone isn't valid.</faultstring>
<detail>
<m:ErrorCode xmlns:m="http://schemas.microsoft.com/exchange/services/2006/messages">-2146233088</m:ErrorCode>
</detail>
</s:Fault>
</s:Body>
All of the examples on MSDN show that Standard and Daylight times have different values for the <Month>. Use different month values but the same <Bias> value for both Daylight and Standard time zones.
Thanks to #WilliamPrice's comment I have managed to resolve this. The answer was to set the Daylight Time month to a different value than the Standard Time when setting those values arbitrarily:
<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:t="http://schemas.microsoft.com/exchange/services/2006/types">
<soap:Body>
<GetUserAvailabilityRequest xmlns="http://schemas.microsoft.com/exchange/services/2006/messages" xmlns:t="http://schemas.microsoft.com/exchange/services/2006/types">
<t:TimeZone xmlns="http://schemas.microsoft.com/exchange/services/2006/types">
<Bias>-120</Bias>
<StandardTime>
<Bias>0</Bias>
<Time>00:00:00</Time>
<DayOrder>1</DayOrder>
<Month>1</Month>
<DayOfWeek>Wednesday</DayOfWeek>
</StandardTime>
<DaylightTime>
<Bias>0</Bias>
<Time>00:00:00</Time>
<DayOrder>1</DayOrder>
**<Month>2</Month>**
<DayOfWeek>Wednesday</DayOfWeek>
</DaylightTime>
</t:TimeZone>
<MailboxDataArray>
<t:MailboxData>
<t:Email>
<t:Address>test1#domain.com</t:Address>
</t:Email>
<t:AttendeeType>Organizer</t:AttendeeType>
<t:ExcludeConflicts>false</t:ExcludeConflicts>
</t:MailboxData>
<t:MailboxData>
<t:Email>
<t:Address>test2#domain.com</t:Address>
</t:Email>
<t:AttendeeType>Required</t:AttendeeType>
<t:ExcludeConflicts>false</t:ExcludeConflicts>
</t:MailboxData>
</MailboxDataArray>
<t:FreeBusyViewOptions>
<t:TimeWindow>
<t:StartTime>2013-05-13T00:55:11</t:StartTime>
<t:EndTime>2013-05-27T00:55:11</t:EndTime>
</t:TimeWindow>
<t:MergedFreeBusyIntervalInMinutes>15</t:MergedFreeBusyIntervalInMinutes>
<t:RequestedView>FreeBusyMerged</t:RequestedView>
</t:FreeBusyViewOptions>
</GetUserAvailabilityRequest>
</soap:Body>

Handling an XML file with Ruby and Nokogiri

I am new to programming so bear with me. I have many XML documents that look like this:
File name: PRIDE_Exp_Complete_Ac_10094.xml.gz
<ExperimentCollection version="2.1">
<Experiment>
<ExperimentAccession>1015</ExperimentAccession>
<Title>Protein complexes in Saccharomyces cerevisiae (GPM06600002310)</Title>
<ShortLabel>GPM06600002310</ShortLabel>
<Protocol>
<ProtocolName>None</ProtocolName>
</Protocol>
<mzData version="1.05" accessionNumber="1015">
<cvLookup cvLabel="RESID" fullName="RESID Database of Protein Modifications" version="0.0" address="http://www.ebi.ac.uk/RESID/" />
<cvLookup cvLabel="UNIMOD" fullName="UNIMOD Protein Modifications for Mass Spectrometry" version="0.0" address="http://www.unimod.org/" />
<description>
<admin>
<sampleName>GPM06600002310</sampleName>
<sampleDescription comment="Ho, Y., et al., Systematic identification of protein complexes in Saccharomyces cerevisiae by mass spectrometry. Nature. 2002 Jan 10;415(6868):180-3.">
<cvParam cvLabel="NEWT" accession="4932" name="Saccharomyces cerevisiae (Baker's yeast)" value="Saccharomyces cerevisiae" />
</sampleDescription>
</admin>
</description>
<spectrumList count="0" />
</mzData>
</Experiment>
I want to take out the text in between "Title", "ProtocolName", and "SampleName" and save into a text file that has the same name as the .xml.gz. I have the following code so far (based on posts I saw on this site), but it seems not to work:
require 'rubygems'
require 'nokogiri'
doc = Nokogiri::XML(File.open("PRIDE_Exp_Complete_Ac_10094.xml.gz"))
#ExperimentCollection = doc.css("ExperimentCollection Title").map {|node| node.children.text }
Can someone help me?
Thanks
IF you are happy with REXML, AND there's only one <Experiment> per file, then something like the following should help ... (by the way, above text is invalid XML since no closing <ExperimentCollection> tag)
require "rexml/document"
include REXML
xml=<<EOD
<Experiment>
<ExperimentAccession>1015</ExperimentAccession>
<Title>Protein complexes in Saccharomyces cerevisiae (GPM06600002310)</Title>
<ShortLabel>GPM06600002310</ShortLabel>
<Protocol>
<ProtocolName>None</ProtocolName>
</Protocol>
<mzData version="1.05" accessionNumber="1015">
<cvLookup cvLabel="RESID" fullName="RESID Database of Protein Modifications" version="0.0" address="http://www.ebi.ac.uk/RESID/" />
<cvLookup cvLabel="UNIMOD" fullName="UNIMOD Protein Modifications for Mass Spectrometry" version="0.0" address="http://www.unimod.org/" />
<description>
<admin>
<sampleName>GPM06600002310</sampleName>
<sampleDescription comment="Ho, Y., et al., Systematic identification of protein complexes in Saccharomyces cerevisiae by mass spectrometry. Nature. 2002 Jan 10;415(6868):180-3.">
<cvParam cvLabel="NEWT" accession="4932" name="Saccharomyces cerevisiae (Baker's yeast)" value="Saccharomyces cerevisiae" />
</sampleDescription>
</admin>
</description>
<spectrumList count="0" />
</mzData>
</Experiment>
EOD
doc = Document.new xml
doc.elements["Experiment/Title"].text
doc.elements["Experiment/Protocol/ProtocolName"].text
doc.elements["Experiment/mzData/description/admin/sampleName"].text

Resources