0

I want to display a calendar list entry on a page. I know the GUID of the entry, but I'm not sure which webpart to use. Basically I want to display the title, location, start time etc on a webpage.

I've tried the content query web part, but it doesn't seem to let me filter using the GUID. I'm assuming the GUID is the best thing to filter on because it's unique.

2

I would use the Content Search Web Part. Using search is better than querying the list directly. Here is an example of setting up a Content Search Web Part Then you can set the search query to filter on the path of the item Path:[urloflist]/forms/dispform.aspx?id=[id] Then use one of the OOB display templates, or, if you prefer, create a custom display template.

If you want to query the list directly, use a script editor web part and use a script similar to what is shown here (see the Retrieving and rendering SharePoint 2013 list items section)

  • Can you refine using the GUID with the content search web part? I haven't been able to. – matt Nov 17 '14 at 19:47
  • I can't seem to find a crawled property for the GUID field in my environment. Without this, it is not possible to refine with on GUID. Depending on your situation, you could switch to the UniqueID managed property, which is refineable. – Kevin Stone Nov 17 '14 at 20:17
1

Using REST you can query this using

https://siteurl/_api/web/lists/GetByTitle('List Title')/items?$filter=GUID eq '661f4ac2-180c-43ce-b43c-bd292180bd43'

You need to insert a Script Editor WebPart and use below Script

$(document).ready(function(){
    $.ajax({
        url: siteurl + "/_api/web/lists/getbytitle('" + listName + "')/items?$filter=GUID eq '661f4ac2-180c-43ce-b43c-bd292180bd43'",
        method: "GET",
        headers: { "Accept": "application/json; odata=verbose" },
        success: function (data) {
            $('#ResultDiv').append(JSON.stringify(data.d.results));
        },
        error: function (data) {
            alert('Failed');
        }
    });
}
  • That's an option, thanks. Any idea how to do it with web parts? – matt Nov 17 '14 at 18:10

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.