CRM 模擬用戶

 

web api 模擬用戶web

轉:https://blog.csdn.net/vic0228/article/details/80649615json

 

var req = new XMLHttpRequest();
    req.open("get",Xrm.Page.context.getClientUrl() + "/api/data/v8.2/accounts(3E6DB783-B65C-E811-80DC-0017FA01322A)?$select=name", false);
    req.setRequestHeader("Accept", "application/json");
    req.setRequestHeader("Content-Type", "application/json; charset=utf-8");
    req.setRequestHeader("OData-MaxVersion", "4.0");
    req.setRequestHeader("OData-Version", "4.0");
    req.setRequestHeader("Prefer", "odata.include-annotations=\"OData.Community.Display.V1.FormattedValue\"");
    req.setRequestHeader("MSCRMCallerID", "FCCBB09D-D559-E811-80D4-0017FA01322A");
    req.send();
    if (req.status == 200)
        var data= JSON.parse(req.responseText);
    else
        throw new Error(JSON.parse(req.responseText).error.message);


若是不加MSCRMCallerID這個頭部,則請求數據時會報錯,提示當前用戶並無讀取該條數據的權限api

當咱們加上了MSCRMCallerID這個頭部後再運行,發現頁面會很奇怪的彈個登陸框出來,若是你點了取消則會看到下述彈框,說你沒有模擬其餘用戶進行操做的權限。安全

 

只要給安全角色加上下圖中的權限便可,這樣你就能夠模擬其餘用戶進行一些數據操做了。app

 

 

 C# 模擬用戶沒有感受沒有成功spa

                OrganizationServiceProxy proxy = new OrganizationServiceProxy(orgServiceUri, null, clientCredentials, null);.net

    proxy.CallerId=xxxx.xxxx.xxxx.xxxx
    code

相關文章
相關標籤/搜索