问题
The Exchange Web Services have a method GetUserConfiguration that needs a UserConfigurationName to determine what settings to retrieve for a folder.
What UserConfigurationNames are available? (specifically for DistinguishedFolderId 'calendar', but a broader list is fine of course).
In a distant past I managed to find 4 but I have no idea where I got those and if this is the entire list. It probably depends on Exchange version as well (these 4 work under 2010).
These are the four I have come up with, in an example SOAP call:
<soap:Body>
<mes:GetUserConfiguration>
<mes:UserConfigurationName Name="CategoryList"> // Alternative 1
<mes:UserConfigurationName Name="Calendar"> // Alternative 2
<mes:UserConfigurationName Name="WorkHours"> // Alternative 3
<mes:UserConfigurationName Name="AvailabilityOptions"> // Alternative 4
<typ:DistinguishedFolderId Id="calendar"/>
</mes:UserConfigurationName>
<mes:UserConfigurationProperties>All</mes:UserConfigurationProperties>
</mes:GetUserConfiguration>
</soap:Body>
回答1:
You'll need to perform a FindItem call with the Associated traversal option (available in 2010+). This will find all of the user configuration object (aka folder associated items) associated with the default calendar folder. You want to request the ItemClass since I believe it contains the configuration name used by EWS to access user configuration object. Depending on what created the user configuration object, you may need to parse out the user configuration name from the ItemClass.
<?xml version="1.0" encoding="utf-8"?>
<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"
xmlns:m="http://schemas.microsoft.com/exchange/services/2006/messages">
<soap:Header>
<t:RequestServerVersion Version="Exchange2013" />
<t:MailboxCulture>en-US</t:MailboxCulture>
</soap:Header>
<soap:Body>
<m:FindItem Traversal="Associated">
<m:ItemShape>
<t:BaseShape>IdOnly</t:BaseShape>
<t:AdditionalProperties>
<t:FieldURI FieldURI="item:ItemClass"/>
</t:AdditionalProperties>
</m:ItemShape>
<m:IndexedPageItemView BasePoint="Beginning" MaxEntriesReturned="100" Offset="0"/>
<m:ParentFolderIds>
<t:DistinguishedFolderId Id="calendar"/>
</m:ParentFolderIds>
</m:FindItem>
</soap:Body>
</soap:Envelope>
You can see the relationship between the user configuration objects you know about (i.e. CategoryList, WorkHours, etc) and the ItemClass in the following response:
<?xml version="1.0" encoding="utf-8"?>
<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/">
<s:Header>
<h:ServerVersionInfo MajorVersion="15" />
</s:Header>
<s:Body>
<m:FindItemResponse>
<m:ResponseMessages>
<m:FindItemResponseMessage ResponseClass="Success">
<m:ResponseCode>NoError</m:ResponseCode>
<m:RootFolder IndexedPagingOffset="9" TotalItemsInView="9" IncludesLastItemInRange="true">
<t:Items>
<t:Message>
<t:ItemId Id="AEz=" ChangeKey="CQ"/>
<t:ItemClass>IPM.Configuration.HomeTimeZone</t:ItemClass>
</t:Message>
<t:Message>
<t:ItemId Id="Az=" ChangeKey="CQ"/>
<t:ItemClass>IPM.Configuration.AvailabilityOptions</t:ItemClass>
</t:Message>
<t:Message>
<t:ItemId Id="AMz=" ChangeKey="CQ"/>
<t:ItemClass>IPC.MS.Outlook.AgingProperties</t:ItemClass>
</t:Message>
<t:CalendarItem>
<t:ItemId Id="ADEz=" ChangeKey="CQ"/>
<t:ItemClass>IPM.Appointment</t:ItemClass>
</t:CalendarItem>
<t:Message>
<t:ItemId Id="ADEz=" ChangeKey="CQ"/>
<t:ItemClass>IPM.Configuration.CategoryList</t:ItemClass>
</t:Message>
<t:Message>
<t:ItemId Id="ADEz=" ChangeKey="CQ"/>
<t:ItemClass>IPM.Configuration.WorkHours</t:ItemClass>
</t:Message>
<t:Message>
<t:ItemId Id="ADEz=" ChangeKey="CQ"/>
<t:ItemClass>IPM.Configuration.Calendar</t:ItemClass>
</t:Message>
<t:Message>
<t:ItemId Id="ADEz=" ChangeKey="CQ"/>
<t:ItemClass>IPM.Microsoft.FolderDesign.NamedView</t:ItemClass>
</t:Message>
</t:Items>
</m:RootFolder>
</m:FindItemResponseMessage>
</m:ResponseMessages>
</m:FindItemResponse>
</s:Body>
</s:Envelope>
来源:https://stackoverflow.com/questions/20473013/available-userconfigurationname-names-for-getuserconfiguration-for-distinguished