2013-07-02 53 views
2

你好Exchange開發,MS Outlook 2013中刪除通過Exchange Web服務API加入MasterCategoryList

我成功地通過Exchange Web服務API增加了幾個自定義類別爲MasterCategoryList自定義類別。我使用的樣品:

var list = MasterCategoryList.Bind(service); 
list.Categories.Add(
    new Category { 
      Name = "Vacation", 
      Color = CategoryColor.DarkMaroon, 
      KeyboardShortcut = CategoryKeyboardShortcut.CtrlF10, 
      Id = Guid.NewGuid() 

});

但過了一段時間後,我注意到我的自定義類別由於某種原因離開MasterCategoryList。儘管我在一段時間後MS Exchange將其歸零(「0000-0000 -...」)後,我發現儘管我將「Guid.NewGuid()」分配給了「Id」屬性。有人解決這個問題嗎?感謝您的關注。

+0

您的意思是說,您的自定義類別從主列表或單個約會中消失(請編輯問題)?我不知道EWS API的具體情況,我使用原始SOAP調用,但是我必須一次性替換*所有*預約類別。因此,要添加一個,全部檢索它們,向我的內存列表中添加一個,將它們全部寫回約會。 –

+0

Hello Jan.據我瞭解,MS Outlook 2013存在問題。我做了以下操作: –

+0

Hello Jan.據我瞭解,MS Outlook 2013存在問題。我通過EWS API將自定義類別插入到MasterCategoryList中。例如通過MS Outlook 2013桌面客戶端添加新類別。之後,我通過EWS檢索MasterCategoryList。所有類別的ID都變爲「00000000-0000-0000-0000-000000000000」。一段時間後,Exchange將刪除除了唯一一個以外的所有自定義類別。我想是因爲重複的ID。你能告訴我更多關於SOAP調用嗎? –

回答

1

感謝您的回答。

看來我解決了這個問題。它出現了「Id」屬性(Category類)的內容應該包含在大括號內。在我的情況下,我使用「Guid」類型作爲「Id」屬性。串行器應用的「ToString」方法和「Id」屬性看起來像「e6de9b1b-a81c-46f6-81b3-c23edfab4478」,但有效值是「{e6de9b1b-a81c-46f6-81b3-c23edfab4478}」。所以我改變了「Id」屬性的類型爲「string」。有效版本如下:

var list = MasterCategoryList.Bind(service); 

list.Categories.Add(

new Category { 
     Name = "Vacation", 
     Color = CategoryColor.DarkMaroon, 
     KeyboardShortcut = CategoryKeyboardShortcut.CtrlF10, 
     Id = "{" + Guid.NewGuid() + "}"; 

}); 

請注意。

0

如果問題是在Outlook中,不兌換,也許你可以嘗試的東西沿着這些路線:

SOAP調用來檢索主類別列表:

<soap:Envelope xmlns:mes="http://schemas.microsoft.com/exchange/services/2006/messages" 
       xmlns:typ="http://schemas.microsoft.com/exchange/services/2006/types" 
       xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"> 
    <soap:Header> 
    <typ:RequestServerVersion Version="Exchange2010" /> 
    </soap:Header> 
    <soap:Body> 
    <mes:GetUserConfiguration> 
     <mes:UserConfigurationName Name="CategoryList"> 
     <typ:DistinguishedFolderId Id="calendar"/> 
     </mes:UserConfigurationName> 
     <mes:UserConfigurationProperties>All</mes:UserConfigurationProperties> 
    </mes:GetUserConfiguration> 
    </soap:Body> 
</soap:Envelope> 

響應:

<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/"> 
    <s:Header> 
     <h:ServerVersionInfo MajorVersion="14" MinorVersion="0" MajorBuildNumber="722" MinorBuildNumber="0" Version="Exchange2010" xmlns:h="http://schemas.microsoft.com/exchange/services/2006/types" xmlns="http://schemas.microsoft.com/exchange/services/2006/types" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"/> 
    </s:Header> 
    <s:Body xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"> 
     <m:GetUserConfigurationResponse xmlns:m="http://schemas.microsoft.com/exchange/services/2006/messages" xmlns:t="http://schemas.microsoft.com/exchange/services/2006/types"> 
     <m:ResponseMessages> 
      <m:GetUserConfigurationResponseMessage ResponseClass="Success"> 
       <m:ResponseCode>NoError</m:ResponseCode> 
       <m:UserConfiguration> 
        <t:UserConfigurationName Name="CategoryList"> 
        <typ:DistinguishedFolderId Id="calendar" xmlns:typ="http://schemas.microsoft.com/exchange/services/2006/types"/> 
        </t:UserConfigurationName> 
        <t:ItemId Id="AAMkADky[snip]1VAZmIKAAAKfSM9AAA=" ChangeKey="CQAAAB[snip]AIlsUeV"/> 
        <t:XmlData>PD94bWw[snip]cmllcz4NCg==</t:XmlData> 
       </m:UserConfiguration> 
      </m:GetUserConfigurationResponseMessage> 
     </m:ResponseMessages> 
     </m:GetUserConfigurationResponse> 
    </s:Body> 
</s:Envelope> 

該XMLData是Base64編碼,如果你解碼它:

<?xml version="1.0"?> 
<categories default="Red Category" lastSavedSession="2" lastSavedTime="2013-04-17T09:10:12.786" xmlns="CategoryList.xsd"> 
    <category name="Red Category" color="0" keyboardShortcut="0" usageCount="2" lastTimeUsedNotes="1601-01-01T00:00:00.000" lastTimeUsedJournal="1601-01-01T00:00:00.000" lastTimeUsedContacts="1601-01-01T00:00:00.000" lastTimeUsedTasks="1601-01-01T00:00:00.000" lastTimeUsedCalendar="1601-01-01T00:00:00.000" lastTimeUsedMail="1601-01-01T00:00:00.000" lastTimeUsed="2010-09-29T10:08:46.487" lastSessionUsed="0" guid="{61C23D24-ED86-47EC-8565-433E3A6B21B7}" renameOnFirstUse="1"/> 
    <category name="Blue Category" color="7" keyboardShortcut="0" usageCount="6" lastTimeUsedNotes="1601-01-01T00:00:00.000" lastTimeUsedJournal="1601-01-01T00:00:00.000" lastTimeUsedContacts="1601-01-01T00:00:00.000" lastTimeUsedTasks="1601-01-01T00:00:00.000" lastTimeUsedCalendar="2013-04-17T09:10:04.043" lastTimeUsedMail="1601-01-01T00:00:00.000" lastTimeUsed="2013-04-17T09:10:04.043" lastSessionUsed="2" guid="{E19DD512-BFF1-46D8-A858-54CC114872AD}"/> 
    <category name="Purple Category" color="8" keyboardShortcut="0" usageCount="2" lastTimeUsedNotes="1601-01-01T00:00:00.000" lastTimeUsedJournal="1601-01-01T00:00:00.000" lastTimeUsedContacts="1601-01-01T00:00:00.000" lastTimeUsedTasks="1601-01-01T00:00:00.000" lastTimeUsedCalendar="1601-01-01T00:00:00.000" lastTimeUsedMail="1601-01-01T00:00:00.000" lastTimeUsed="2010-09-29T10:08:46.487" lastSessionUsed="0" guid="{FD3AFB30-285E-4BF2-885E-F9FDFE00002E}" renameOnFirstUse="1"/> 
    <category name="Green Category" color="4" keyboardShortcut="0" usageCount="6" lastTimeUsedNotes="1601-01-01T00:00:00.000" lastTimeUsedJournal="1601-01-01T00:00:00.000" lastTimeUsedContacts="1601-01-01T00:00:00.000" lastTimeUsedTasks="1601-01-01T00:00:00.000" lastTimeUsedCalendar="2013-04-17T09:10:12.782" lastTimeUsedMail="1601-01-01T00:00:00.000" lastTimeUsed="2013-04-17T09:10:12.782" lastSessionUsed="2" guid="{C3DC51D0-1CC4-42CF-9FA9-75146905771F}"/> 
    <category name="Orange Category" color="1" keyboardShortcut="0" usageCount="2" lastTimeUsedNotes="1601-01-01T00:00:00.000" lastTimeUsedJournal="1601-01-01T00:00:00.000" lastTimeUsedContacts="1601-01-01T00:00:00.000" lastTimeUsedTasks="1601-01-01T00:00:00.000" lastTimeUsedCalendar="1601-01-01T00:00:00.000" lastTimeUsedMail="1601-01-01T00:00:00.000" lastTimeUsed="2010-09-29T10:08:46.487" lastSessionUsed="0" guid="{10C78B6F-5828-4B3C-AF0C-138AAAC52DAE}" renameOnFirstUse="1"/> 
    <category name="Yellow Category" color="3" keyboardShortcut="0" usageCount="2" lastTimeUsedNotes="1601-01-01T00:00:00.000" lastTimeUsedJournal="1601-01-01T00:00:00.000" lastTimeUsedContacts="1601-01-01T00:00:00.000" lastTimeUsedTasks="1601-01-01T00:00:00.000" lastTimeUsedCalendar="1601-01-01T00:00:00.000" lastTimeUsedMail="1601-01-01T00:00:00.000" lastTimeUsed="2010-09-29T10:08:46.487" lastSessionUsed="0" guid="{37CC21D3-B6A9-4DAE-A1FB-422249B9FBB0}" renameOnFirstUse="1"/> 
    <category name="TimeTell" color="7" keyboardShortcut="0" usageCount="7" lastTimeUsedNotes="1601-01-01T00:00:00.000" lastTimeUsedJournal="1601-01-01T00:00:00.000" lastTimeUsedContacts="1601-01-01T00:00:00.000" lastTimeUsedTasks="1601-01-01T00:00:00.000" lastTimeUsedCalendar="2013-04-17T09:09:59.980" lastTimeUsedMail="1601-01-01T00:00:00.000" lastTimeUsed="2013-04-17T09:09:59.980" lastSessionUsed="2" guid="{3348E50B-1763-42FB-A9E9-25B74038B9AA}"/> 
</categories> 

也許你可以做些什麼,使用SetUserConfiguration ...

相關問題