質問

I have two user column in SharePoint 2013 RequestedFor and CC. I want to display items only if the user in either column is equal current log in user.

So far I'm able to display items when Requested for is equal to log in user. I want to show items if the user is part of RequestedFor or CC field.

var userId = _spPageContextInfo.userId;function loadListItems(){var oDataUrl = _spPageContextInfo.webAbsoluteUrl + "/_api/web/lists/getbytitle('SupportList')/items?$select=ID,Created,Modified,Title,Status,RequestType,RequestedFor/Title,CC/Title&$expand=CC,AssignedTo/Title&$expand=RequestedFor,AssignedTo&$filter=RequestedFor eq " + userId;
console.log(_spPageContextInfo);
$.ajax(
{url: oDataUrl,
    type: "GET",
    dataType: "json",
    headers:
    {
        "accept": "application/json;odata=verbose"
    },
    success: successFunction,
    error: errorFunction
});}
役に立ちましたか?

解決

Use your REST API endpoint similar to this:

"$select=Title,RequestedFor/ID,CC/ID&$expand=RequestedFor,CC&$filter=(RequestedFor/ID eq " + userId + " or CC/ID eq " + userId + ")";
ライセンス: CC-BY-SA帰属
所属していません sharepoint.stackexchange
scroll top