none
How to Get Regional Settings Of User using EWS Managed API RRS feed

  • Question

  • How Can I get Regional Settings of Outlook (Which has Current Time zone, Language and Other settings) using EWS Managed API. 

    Thanks.

    Tuesday, April 16, 2013 8:36 PM

All replies

  • Majid Ali, Did you find the answer for this question? I also need to know how to get Regional Settings using EWS.
    Thursday, December 4, 2014 6:08 PM
  • There is no direct way to access the regional setting with EWS. In Exchange 2010 and greater you can get the timezone setting using the WorkHours FAI item in the mailbox's calendar via the UserConfiguration operation in EWS eg http://msdn.microsoft.com/en-us/library/exchange/gg274398(v=exchg.80).aspx

    eg

                UserConfiguration WorkHours;
                WorkHours = UserConfiguration.Bind(service, "WorkHours", WellKnownFolderName.Calendar, UserConfigurationProperties.All);
                XmlDocument xmlConfig = new XmlDocument();
                xmlConfig.LoadXml(Encoding.UTF8.GetString(WorkHours.XmlData));
    
                XmlNodeList xmlList = xmlConfig.GetElementsByTagName("TimeSlot");
                if (xmlList.Count > 0) {
                    for (Int32 ncCnt = 0; xmlList[0].ChildNodes.Count > ncCnt;ncCnt++ )
                    {
                        XmlNode ChildNode = xmlList[0].ChildNodes[ncCnt];
                        if (ChildNode.Name == "Start")
                        {
                            Console.WriteLine(ChildNode.InnerText);
                        }
                        if (ChildNode.Name == "End")
                        {
                            Console.WriteLine(ChildNode.InnerText);
                        }
                    }
                    
                }
                XmlNodeList xmlList1 = xmlConfig.GetElementsByTagName("TimeZone");
                if (xmlList1.Count > 0)
                {
                    for (Int32 ncCnt = 0; xmlList1[0].ChildNodes.Count > ncCnt; ncCnt++)
                    {
                        XmlNode ChildNode = xmlList1[0].ChildNodes[ncCnt];
                        if (ChildNode.Name == "Name") {
                            Console.WriteLine(ChildNode.InnerText);
                        }
                    }
    
                }
     

    The format of the XMLdocument is documented in http://msdn.microsoft.com/en-us/library/cc463899(v=exchg.80).aspx

    For the language there is no direct method so you need to use a workaround like you can get the Inbox via the WellKnowFolderId\distinguished folderId and then test the displayName to work it out. (Its a pain and manual and you need to know all the displaynames to test against but it should work as a workaround).

    Cheers
    Glen

    Friday, December 5, 2014 3:44 AM