none
Other calendars in EWS RRS feed

  • Question

  • In OWA, you have "Other calendars".

    If I right click "Other calendars" and press "open", I can provide an "Internet calendar" by entering a URL.

    If I do this, is it possible to get that calendar trough the EWS SOAP interface?

    Wednesday, September 3, 2014 4:54 PM

Answers

  • Yes when you add a calendar that way a local Calendar folder will be created as a sub Folder of that Mailboxes calendar Folder to Store the synced items.

    So you should use a FindFolder operation on the Mailboxes Calendar Folder to Find that subfolder then use a normal FindItems operation to enumerate the calendar items in that Folder. You can test and see the necessary SOAP using the EWSEditor http://ewseditor.codeplex.com/

    Cheers
    Glen

    • Marked as answer by Karl Karlstad Thursday, September 4, 2014 8:10 PM
    Thursday, September 4, 2014 6:11 AM

All replies

  • Yes when you add a calendar that way a local Calendar folder will be created as a sub Folder of that Mailboxes calendar Folder to Store the synced items.

    So you should use a FindFolder operation on the Mailboxes Calendar Folder to Find that subfolder then use a normal FindItems operation to enumerate the calendar items in that Folder. You can test and see the necessary SOAP using the EWSEditor http://ewseditor.codeplex.com/

    Cheers
    Glen

    • Marked as answer by Karl Karlstad Thursday, September 4, 2014 8:10 PM
    Thursday, September 4, 2014 6:11 AM
  • Great info, the FindFolder operation worked perfectly. Its a shame I must use the FindItems operation instead of the GetUserAvailability operation.

    Just as a follow up. Are there any reasons that other peoples calendar's that I have added under "People's calendar" are not returned by the FindFolder operation?

    Thursday, September 4, 2014 6:28 PM
  • Yes they are implemented a little differently if you add an internet calendar then the client will sync it to a local folder in the Mailbox. If you add a shared calendar (interorg) then all you have is a shortcut in the Mailbox and the client will query the other calendar folder live for you. To implement this in EWS you need to query the NavLinks that are stored in the Common Views folder in a Mailbox which is under the NonIPMSubtree (root) see http://msdn.microsoft.com/en-us/library/ee157359(v=exchg.80).aspx. You can use EWS to get the NavLinks from a Mailbox and use the PidTagWlinkAddressBookEID extended property to get the X500 address of the Mailbox these Links refer to and then use Resolve Name to resolve that to a SMTP Address. Then all you need to do is Bind to that folder eg

    static Dictionary<string, Folder> GetSharedCalendarFolders(ExchangeService service, String mbMailboxname)
        {
            Dictionary<String, Folder> rtList = new System.Collections.Generic.Dictionary<string, Folder>();
    
            FolderId rfRootFolderid = new FolderId(WellKnownFolderName.Root, mbMailboxname);
            FolderView fvFolderView = new FolderView(1000);
            SearchFilter sfSearchFilter = new SearchFilter.IsEqualTo(FolderSchema.DisplayName, "Common Views");
            FindFoldersResults ffoldres = service.FindFolders(rfRootFolderid, sfSearchFilter, fvFolderView);
            if (ffoldres.Folders.Count == 1)
            {
    
                PropertySet psPropset = new PropertySet(BasePropertySet.FirstClassProperties);
                ExtendedPropertyDefinition PidTagWlinkAddressBookEID = new ExtendedPropertyDefinition(0x6854, MapiPropertyType.Binary);
                ExtendedPropertyDefinition PidTagWlinkFolderType = new ExtendedPropertyDefinition(0x684F, MapiPropertyType.Binary);
                ExtendedPropertyDefinition PidTagWlinkGroupName = new ExtendedPropertyDefinition(0x6851, MapiPropertyType.String);
    
                psPropset.Add(PidTagWlinkAddressBookEID);
                psPropset.Add(PidTagWlinkFolderType);
                ItemView iv = new ItemView(1000);
                iv.PropertySet = psPropset;
                iv.Traversal = ItemTraversal.Associated;
    
                SearchFilter cntSearch = new SearchFilter.IsEqualTo(PidTagWlinkGroupName, "Other Calendars");
                FindItemsResults<Item> fiResults = ffoldres.Folders[0].FindItems(cntSearch, iv);
                foreach (Item itItem in fiResults.Items)
                {
                    try
                    {
                        object GroupName = null;
                        object WlinkAddressBookEID = null;
                        if (itItem.TryGetProperty(PidTagWlinkAddressBookEID, out WlinkAddressBookEID))
                        {
    
                            byte[] ssStoreID = (byte[])WlinkAddressBookEID;
                            int leLegDnStart = 0;
                            String lnLegDN = "";
                            for (int ssArraynum = (ssStoreID.Length - 2); ssArraynum != 0; ssArraynum--)
                            {
                                if (ssStoreID[ssArraynum] == 0)
                                {
                                    leLegDnStart = ssArraynum;
                                    lnLegDN = System.Text.ASCIIEncoding.ASCII.GetString(ssStoreID, leLegDnStart + 1, (ssStoreID.Length - (leLegDnStart + 2)));
                                    ssArraynum = 1;
                                }
                            }
                            NameResolutionCollection ncCol = service.ResolveName(lnLegDN, ResolveNameSearchLocation.DirectoryOnly, true);
                            if (ncCol.Count > 0)
                            {
    
                                FolderId SharedCalendarId = new FolderId(WellKnownFolderName.Calendar, ncCol[0].Mailbox.Address);
                                Folder SharedCalendaFolder = Folder.Bind(service, SharedCalendarId);
                                rtList.Add(ncCol[0].Mailbox.Address, SharedCalendaFolder);
    
    
                            }
    
                        }
                    }
                    catch (Exception exception)
                    {
                        Console.WriteLine(exception.Message);
                    }
    
                }
            }
            return rtList;
        }
    Cheers
    Glen

    Friday, September 5, 2014 4:25 AM