【问题标题】:How to add contact in office365 using api for php如何使用 api for php 在 office365 中添加联系人
【发布时间】:2015-12-07 15:53:51
【问题描述】:

我想询问有关 Office365 CRM 的问题,使用此 CRM 我获得了访问令牌,但不幸的是如何使用该访问令牌添加联系人并获取联系人详细信息。当我尝试将联系人添加到 CRM 中时,我收到了类似 401 Http 请求的错误。而且我不知道发送到 CRM 的请求的标头字段和有效负载格式。

【问题讨论】:

    标签: php api office365api


    【解决方案1】:

    https://msdn.microsoft.com/office/office365/APi/contacts-rest-operations#GetContacts 这是用于获取访问代码、用户邮件地址的链接。您已获得用于创建联系人的 access_token 和用户邮件地址。

    public static function createcontact($access_token, $user_email) {
        $email = array (
                "Address" => "sample.onmicrosoft.com",
                "Name" => "kkkkk" 
        );
        $email_value = json_encode ( $email );
        $getContactsParameters = array (
                "GivenName" => "sample",
                "Surname" => "xxxxxxx",
    
                "BusinessPhones" => array (
                        "+00000000" 
                ) 
        );
    
        $data_string = json_encode ( $getContactsParameters );
        $getContactsUrl = self::$outlookApiUrl . "/Me/Contacts?";
    
        return self::makeApiCall ( $access_token, $user_email, "POST", $getContactsUrl, $data_string );
    }
    

    【讨论】:

      【解决方案2】:

      您必须设置范围、设置 url 和设置正文以创建联系人

      范围:https://outlook.office.com/contacts.readwrite

      网址:https://api.office.com/discovery/v2.0/me/

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2016-02-26
        • 2016-10-14
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多