Where is SiteLogoUrl in CSOM?

I found SPWeb.SiteLogoUrl and was expecting this property in CSOM and REST. But I did not find it. How can I get SiteLogoUrl using CSOM or REST?

SP.js

Microsoft.SharePoint.Client.dll

+4
source share
2 answers

It has been moved to a POST request that SharePoint creates when redirecting through appredirect.aspx. Thus, the only way to get the website logo URL is to process the appredirect email request.

To initiate a redirect, you must use this piece of code:

Response.Redirect(TokenHelper.GetAppContextTokenRequestUrl(sharePointHostUrl, Server.UrlEncode(targetUrl))); 

ContextToken, SiteLogo, Url, Title, etc. can be found in the form POST FormData.

+1
source

According to UserVoice, Improving SharePoint Management API Microsoft has released SharePoint 2013 and SharePoint Online Solution Packs , which contain the following change for the existing API:

Web object provides AlternateCssUrl property via CSOM (.Net, REST, JS)

Alternatively, you can install the latest versions of the SharePoint Server 2013 Client Component Component or the SharePoint Online Client Component Component

<strong> Examples

How to update the Web.AlternateCssUrl property using CSOM:

 using (var ctx = new ClientContext(webUri)) { ctx.Web.AlternateCssUrl = "/SiteAssets/Contoso.css"; ctx.Web.Update(); ctx.ExecuteQuery(); } 

How to get the Web.AlternateCssUrl property using REST:

 $.getJSON(_spPageContextInfo.webAbsoluteUrl + "/_api/web") .done(function(data) { console.log(data.AlternateCssUrl); }) .fail( function(error){ console.log(JSON.stringify(error)); }); 
+1
source

Source: https://habr.com/ru/post/1497781/


All Articles