Accesing SharePoint2013 SEO fields

This is rather simple. You can the fields under each item document library or list. Look at the sample code below:

if(SPContext.Current.File != null)
seoCanonical = SPContext.Current.File.Item[“EncodedAbsUrl”] as String;
if (SPContext.Current.File.Item.Fields.ContainsField(“SeoKeywords”))
seoKeywords = SPContext.Current.File.Item[“SeoKeywords”] as String;

if (SPContext.Current.File.Item.Fields.ContainsField(“SeoMetaDescription”))
seoMetaDescription = SPContext.Current.File.Item[“SeoMetaDescription”] as String;
//var seoFields = SPContext.Current.File.Item.Fields.Cast<SPField>().Where(o => o.StaticName.ToLower().Contains(“seo”));

The field IDs are:



Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s