vendredi 13 mars 2015

Inject HTML into SharePoint view (AllItems.aspx) via powershell

This is a good question with no good answer.

I have my own custom HTML I want to inject into various existing SharePoint views, via powershell. I've been doing this via SharePoint designer so far - is there a way to automate this?

I can't find the relevant API, though I'm sure there's a way to do it.

$web = Get-SPWeb ""
$list = $web.Lists["Contracts"]

$list.Views["All Documents"].HtmlSchemaXml

The below gives me XML like the following.

<View Name="{127149EA-D867-4E3A-BBF2-9A6A62678E53}" DefaultView="TRUE" MobileView="TRUE" MobileDefaultView="TRUE" Type="HTML" DisplayName="All Documents" Url="/sites/crm/hr/Contracts/Forms/AllItems.aspx" Level="1" BaseViewID="1" ContentTypeID="0x" ImageUrl=
"/_layouts/15/images/dlicon.png?rev=23"><XslLink Default="TRUE">main.xsl</XslLink><JSLink>clienttemplates.js</JSLink><RowLimit Paged="TRUE">30</RowLimit><Toolbar Type="Standard" /><ViewFields><FieldRef Name="DocIcon" /><FieldRef Name="LinkFilename" /><Field
Ref Name="Modified" /><FieldRef Name="Editor" /></ViewFields><ParameterBindings><ParameterBinding Name="NoAnnouncements" Location="Resource(wss,noitemsinview_doclibrary)" /><ParameterBinding Name="NoAnnouncementsHowTo" Location="Resource(wss,noitemsinview_d
oclibrary_howto2)" /></ParameterBindings><Query><OrderBy><FieldRef Name="FileLeafRef" /></OrderBy></Query></View>

Is there a way to set/get the view HTML?

0 commentaires:

Enregistrer un commentaire