CalDavSynchronizer.DataAccess.WebDavDataAccess.GetCurrentUserPrincipalUrl C# (CSharp) Method

GetCurrentUserPrincipalUrl() protected method

protected GetCurrentUserPrincipalUrl ( Uri calenderUrl ) : Task
calenderUrl System.Uri
return Task
    protected async Task<Uri> GetCurrentUserPrincipalUrl (Uri calenderUrl)
    {
      var principalProperties = await GetCurrentUserPrincipal (calenderUrl);

      XmlNode principalUrlNode = principalProperties.XmlDocument.SelectSingleNode ("/D:multistatus/D:response/D:propstat/D:prop/D:current-user-principal", principalProperties.XmlNamespaceManager) ??
                                 principalProperties.XmlDocument.SelectSingleNode ("/D:multistatus/D:response/D:propstat/D:prop/D:principal-URL", principalProperties.XmlNamespaceManager);

      if (principalUrlNode != null && !string.IsNullOrEmpty (principalUrlNode.InnerText))
        return new Uri (principalProperties.DocumentUri.GetLeftPart (UriPartial.Authority) + principalUrlNode.InnerText);
      else
        return null;
    }