o365 rest api联系方式,无房产传真?

问题描述:

我使用API​​ REST在O365中导入了一些联系人。我的代码效果很好。我更新所有字段。但就我而言,导入的最后一个字段是BusinessFax编号。而我并没有发现这个领域!在O365 Web应用程序或Outlook中,我查看了一些传真号码的字段。但是,没有REST API O365的文档中:https://msdn.microsoft.com/office/office365/api/complex-types-for-mail-contacts-calendar#RESTAPIResourcesContacto365 rest api联系方式,无房产传真?

,并没有在数据定义类型:https://outlook.office.com/api/v2.0/ $元

如果我测试我的JSON文件的一些属性:传真,FaxNumber,BusinessFax,...我得到错误400,错误的请求:(

它amaziiiiiiiing ......那么,如何导入联系人的传真号码???哈哈

尼科

该属性尚未在办公室的支持365休息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网站进行身份验证起动转矩大,这里有供您参考链接:

http://blogs.msdn.com/b/webdav_101/archive/2015/05/11/ews-authentication-issues.aspx

展望REST API现在支持在测试终端,你可以用它来获取/设置属性上该项目的默认形状不返回扩展属性。如果你想与他们的BusinessFax价值联系,这是因为这样做一个GET对一样简单:(十六进制值是MAPI属性标记值BusinessFax,这是0x3A24)

https://outlook.office.com/api/beta/Me/Contacts?$expand=SingleValueExtendedProperties($filter=PropertyId eq 'String 0x3A24') 

您还可以使用补丁更新给定联系人的企业传真号码。这里的JSON有效载荷会是什么样子:

{ 
    "SingleValueExtendedProperties" : 
    [ 
    { 
     "PropertyId" : "String 0x3A24", 
     "Value" : "123-456-7890" 
    } 
    ] 
} 

再次,这是目前仅在公测端点支持,这是我们不建议使用任何的生产代码,经常有重大更改。

Reference For Extended Properties in REST