SharePoint server, recipes from the past



Content type with document link

<?xml version="1.0" encoding="utf-8"?>
<Elements xmlns="http://schemas.microsoft.com/sharepoint/">
<!-- Parent ContentType: Document (0x0101) -->
<ContentType ID="0x010100F605427E752A4BAA862209C34B3F09C6"
Name="VA BaseDocument"
Group="Virtual Affairs Content Types"
Description="VA BaseDocument"
Inherits="TRUE"
Version="0" >
<FieldRefs>
<FieldRef ID="{43B20842-67DB-46E8-AF77-67A6D2411343}"
DisplayName="Confidentiality"
Required="TRUE"
Name="Confidentiality" />
</FieldRefs>
<DocumentTemplate TargetName="~Site/Documents/PurchaseOrder.dotx" />
</ContentType>
</Elements>



Content Query Web Part parameter to XSL Stylesheet


I will add the web part title property just to demonstrate how this can be done. Open your custom content query web part .webpart file and under property "ParameterBindings" add your property so the code would look like:

<property name="ParameterBindings" type="string">
<ParameterBinding Name="WebPartTitle" Location="WPProperty(Title)"/>
</property>

... where the WPProperty(Title) ... Title is your property. Then go to the /Style Library/Custom Style Sheets/ContentQueryMain.xsl or wherever your ContentQueryMain.xsl is and after to other params add yours ...


<xsl:param name="WebPartTitle" />

... so now the value of the web part title property can be used in both (ContentQueryMain.xsl and ItemStyle.xsl) XSL files as example:


<xsl:value-of select="$WebPartTitle" />

One good reference for passing the CurrentPos in your ItemStyle.xsl here: http://pholpar.wordpress.com/2010/01/21/displaying-results-in-multiple-columns-using-the-content-query-web-part/ Custom Date Formats in SharePoint XSL: http://blogs.msdn.com/b/joshuag/archive/2009/03/25/custom-date-formats-in-sharepoint-xsl.aspx



SharePoint Powershell Force Install solution with bin deployment


PS C:\Users\Administrator> Install-SPSolution -Identity contoso.wsp -Force -FullTrustBinDeployment -GACDeployment -WebApplication "contoso webapp"


Get list item versions computed data with CSOM


It will pull data only for computed the following fields: CheckInComment,Created,CreatedBy,ID,IsCurrentVersion,Length,Size,Url,VersionLabel


var id = new Guid(item["UniqueId"].ToString());
var file1 = clientContext.Web.GetFileById(id);
clientContext.Load(file1);
clientContext.Load(file1.Versions);
clientContext.ExecuteQuery();

var versions = file1.Versions;

For advanced custom fields data you should use Lists.asmx service. See PnP for more info.