4

I'm working on an app to provision design elements to SharePoint Online. My project is relying on extension methods in OfficeDevPnPCore. This library references v16 of Microsoft.SharePoint.Client. I need to AlternateCssUrl and SiteLogoUrl. These are fairly new (2014 April CU, according to a comment in PnP) and the recommended way to perform branding in SPO, as far as I understand. But I can only find these methods in v15 of Microsoft.SharePoint.Client. The problem is that if I reference v15 in my project, I can't compile it, since it also includes a reference to OfficeDevPnPCore and v16. How can I solve this situation?

2

In the latest version (16.0.3104.1200) of SharePoint Online Client Components SDK available for download currently, Web object exposes AlternateCssUrl and SiteLogoUrl properties:

using (var context = new ClientContext(webUri))
{
     var web = context.Web;
     web.AlternateCssUrl = web.ServerRelativeUrl + "/SiteAssets/contoso.css";
     web.SiteLogoUrl = web.ServerRelativeUrl + "/SiteAssets/99x.png";
     web.Update();
     web.Context.ExecuteQuery();    
}
  • Vadim: do you by any chance know if and which CU for on-premises contains the required REST API changes to make the above code work for SP on-premises installations? TIA! – Sig Weber Sep 23 '14 at 21:32
  • Sig, it seems it was added in 2014 April CU for on-premises, github.com/OfficeDev/PnP/tree/master/Samples/… – Vadim Gremyachev Sep 23 '14 at 21:38
  • 1
    Thanks Vadim. FYIO: the link you pointed me to mentions a June 30th 2014 release date. Couldn't find it when I asked in August, though sharepoint.stackexchange.com/questions/113238/… – Sig Weber Sep 23 '14 at 21:54
  • 2
    Oh, I did not know there was a separate SDK for SharePoint Online. I had already updated the normal one, but missed this one. Installing it solved my problem. Thank you! – rlv-dan Sep 24 '14 at 5:24
0

I'm guessing you don't have the v16 DLLs on your system, or you have an old version. If so, delete and re-install the Client Components SDK

They change fairly frequently so if things start breaking or failing to compile check for a new version.

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.