Question

I want to achieve something like shown in Image below. I want to display Recent Document visited by logged in user.

I have tried it using Content Search Web-Part. I also tried to achieve it using Search API.

With the help of Content Search Web-Part, I got the result displaying recently viewed documents but it did not displayed results w.r.t. logged in user.

Can this be achieved using REST API? Are there any other Client Side method to achieve this?

<Site Url>/_api/search/query?querytext='path:<Site URL>/TestDocLibrary IsDocument:true'&sortlist='ViewsRecent:descending'

enter image description here

Was it helpful?

Solution

Hello Friends Finally i manage my task I Got the Solution for my Question, As per my requirment I need to display Recent View Doc by logged in User From Sharepoint Online.To Get this result i used GRAPH Query+Search api, you can get more Exposure about GQL Graph Query Language Here is MY Query

//Graph Query with Search api to get Recentview Document By Logged in User it will Return data From all Site Collection of tenent

var query = "/_api/search/query?QueryText='(*) AND (FileExtension:doc OR FileExtension:docx OR FileExtension:ppt OR FileExtension:pptx OR FileExtension:xls OR FileExtension:xlsx OR FileExtension:xlsm OR FileExtension:pdf)'&Properties='TitleBasedSummaries:true,GraphQuery:actor(me\\,action\\:1001),GraphRankingModel:action\\:1001\\,weight\\:1\\,edgeFunc\\:time\\,mergeFunc\\:max'&SelectProperties='Author,AuthorOwsUser,DocId,DocumentPreviewMetadata,Edges,EditorOwsUser,FileExtension,FileType,HitHighlightedProperties,HitHighlightedSummary,LastModifiedTime,LikeCountLifetime,ListID,ListItemID,OriginalPath,Path,Rank,SPWebUrl,SecondaryFileExtension,ServerRedirectedURL,SiteTitle,Title,ViewCountLifetime,siteID,uniqueID,webID'&RowLimit=6&StartRow=0&ClientType='PulseWeb'&BypassResultTypes=true&RankingModelId='0c77ded8-c3ef-466d-929d-905670ea1d72'";

I will Share Full Code soon Thanks

OTHER TIPS

Unfortunately, there is no out of box solution that will provide you with the "Most Visited" documents that you would like.

You can try to create a custom solution to pull the information that you would like and display it in a web part.

Below I am including some links to resources that you can use in an attempt to create a custom solution that you desire.

Licensed under: CC-BY-SA with attribution
Not affiliated with sharepoint.stackexchange
scroll top