none
SharePoint 2016 / Filter webpart RRS feed

  • Question

  • Hi all,

    I have done a custom webpart to inject js with CAML query to filter out of the box document library. However, there are problems that when apply the filter by user A, the same filter result will be apply to user B. Is it make sense ?

    If consider using URL filter, it cannot search / filter the document within sub folder

    Thursday, December 5, 2019 5:50 AM

All replies

  • Hi yiu kwan yu,

    Please use user Id to filter Person or Group Column in CAML like this:

    <Where>
     <Eq>
      <FieldRef Name='User' LookupId='TRUE' />
       <Value Type='Lookup'>1</Value>
     </Eq>
    </Where>

    The Caml Query above will filter the "Created By" field with User Id 1, you could replace it with user B 's Id.

    you could check out the User Id for each user using the Rest Endpoint below:

    /_api/web/siteusers

    Thanks

    Best Regards


    Please remember to mark the replies as answers if they helped. If you have feedback for TechNet Subscriber Support, contact tnmff@microsoft.com.

    SharePoint Server 2019 has been released, you can click here to download it.
    Click here to learn new features. Visit the dedicated forum to share, explore and talk to experts about SharePoint Server 2019.



    Friday, December 6, 2019 5:06 AM