c# - Cannot Update SharePoint Publishing Page Image -
i trying update publishing page image url somehow after execute query command. value saved null
clientcontext targetcontext = new clientcontext ("real url"); microsoft.sharepoint.client.file targetfile = targetcontext.web.getfilebyserverrelativeurl ("real url"); var targetpublishingpage = publishingpage.getpublishingpage (targetcontext, targetfile.listitemallfields); targetcontext.load (targetpublishingpage.listitem); targetcontext.executequery (); targetfile.checkout (); targetpublishingpage.listitem["publishingpageimage"] = "real url"; targetpublishingpage.listitem.update (); targetcontext.executequery ();
publishing image field value expected specified in folliowing format: <img src='{imageurl}'>
example
using (var ctx = new clientcontext(weburi)) { var pagefile = ctx.web.getfilebyserverrelativeurl(pageurl); var pageitem = pagefile.listitemallfields; pageitem["publishingpageimage"] = "<img src='/publishingimages/pagelogo.png'>"; pageitem.update(); ctx.executequery(); }
Comments
Post a Comment