Office 365 REST API 尚不支持此属性。作为一种解决方法,我们可以通过 Exchange Web 服务获取此属性。以下是检索传真电话号码的代码示例,供您参考:
public static void Main(string[] args)
{
ExchangeService service = new ExchangeService();
service.Credentials = new WebCredentials("{EmailAddress}", "{Password}");
service.TraceEnabled = true;
service.TraceFlags = TraceFlags.All;
service.AutodiscoverUrl("{EmailAddress}", RedirectionUrlValidationCallback);
Folder contacts = Folder.Bind(service, WellKnownFolderName.Contacts);
SearchFilter sf = new SearchFilter.SearchFilterCollection(LogicalOperator.And, new SearchFilter.IsEqualTo(ContactSchema.GivenName, "user1"));
ItemView view = new ItemView(1);
FindItemsResults<Item> findResults =service.FindItems(WellKnownFolderName.Contacts,sf, view);
foreach (Item item in findResults)
{
if (item is Contact)
{
Contact contact = item as Contact;
Console.WriteLine(contact.PhoneNumbers[PhoneNumberKey.BusinessFax]);
}
}
}
private static bool RedirectionUrlValidationCallback(string redirectionUrl)
{
// The default for the validation callback is to reject the URL.
bool result = false;
Uri redirectionUri = new Uri(redirectionUrl);
// Validate the contents of the redirection URL. In this simple validation
// callback, the redirection URL is considered valid if it is using HTTPS
// to encrypt the authentication credentials.
if (redirectionUri.Scheme == "https")
{
result = true;
}
return result;
}
您可以通过以下链接参考此属性:
https://msdn.microsoft.com/en-us/library/microsoft.exchange.webservices.data.contact_properties(v=exchg.80).aspx
https://msdn.microsoft.com/en-us/library/microsoft.exchange.webservices.data.contact.phonenumbers(v=exchg.80).aspx
https://msdn.microsoft.com/en-us/library/microsoft.exchange.webservices.data.phonenumberkey(v=exchg.80).aspx
您可能还对使用 Exchange Web 服务进行身份验证感兴趣,以下是供您参考的链接:
http://blogs.msdn.com/b/webdav_101/archive/2015/05/11/ews-authentication-issues.aspx