문제

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