Tuesday, July 11, 2017

How to launch a document by clicking a link to the file?

Word:
<a href='ms-word:ofe|u|path/to/web/word/document.docx'>Link to document</a>

Excel:
<a href='ms-excel:ofe|u|path/to/web/word/document.xlsx'>Link to document</a>

Powerpoint
<a href='ms-powerpoint:ofe|u|path/document.pptx'>Link to document</a>

Monday, July 3, 2017

CSOM - Get list items using SPSiteDataQuery


SPList oList = context.GetWebList(LISTNAME);
Guid listGuid = oList.ID;

SPSiteDataQuery dataQuery = new SPSiteDataQuery();
dataQuery.Webs = "<Webs Scope=\"Recursive\">";
SPQuery query = new SPQuery();
query.Query = string.Format("<Where><And><Eq><FieldRef Name='Title' /><Value Type='Text'>{0}</Value></Eq></Where><OrderBy><FieldRef Name='ID'/></OrderBy>", titleString);

dataQuery.Query = query.Query;
dataQuery.Lists = string.Format("<Lists><List ID=\"{0}\" /></Lists>", listGuid);
dataQuery.ViewFields = "<FieldRef Name=\"Title\" Nullable=\"TRUE\"/>";

DataTable dt = GetResults(dataQuery, "TableName");

Sync document library with PC using javascript

EnsureScriptFunc('offline.js', 'TakeOfflineToClientReal', function() {
           TakeOfflineToClientReal(2, 53, 'https://siteUrl/', 1, 101, listGuid, folderUrl);
});

TakeOfflineToClientReal (scope, siteTemplate, siteUrl, listBaseType, listTemplateId, listGuid, folderUrl)