Skip to main content

Posts

Showing posts from September, 2014

How to add/update SharePoint user field (person group column) using ECMA Scripts

  SharePoint app model supports enough capability to work with SharePoint from JavaScript. Working with Person Group column is a common task in SharePoint development. Following illustrates how to  update  a single and multiple values to  SharePoint person group column. Insert / Update Single Value SharePoint Person Group Column (People Field) Tip: For single value you should refer the person or group by ID var user = new SP.FieldUserValue(); user = 1; // this is the ID for User or Group in SharePoint listitem.set_item( "Column Name" , user); listitem.Update(); ctx.ExecuteQuery(); Insert / Update Multi Value SharePoint Person Group Column (People Field) Tip: For multiple users you need to refer it by login name var users =[];   users.push(SP.FieldUserValue.fromUser( "dev Members" )); // adding group users.push(SP.FieldUserValue.fromUser( "i:0#.f|membership|melick@oapp.onmicrosoft.com" )); // adding user   listitem.set_item( "Column Name...

Session on SharePoint App Architectural View

Audience: 20+

Programmatically Change Default Content Type in SharePoint 2013 List

  SharePoint list does not have any direct property or method to make content type default. but it is having content type ordering. thus making content type in first of the list automatically makes that content type default. following shows a sample code using (var site = new SPSite( "url" )) { using (var web = site.AllWebs[ "yourweb" ]) { var lst = web.Lists[ "Your List" ]; SPContentTypeCollection currentOrder = lst.ContentTypes;   // make default content type var newOrder = currentOrder.Cast<SPContentType>().Where(ct => ct.Name.Contains( "Content Type To Default" )).ToList(); lst.RootFolder.UniqueContentTypeOrder = newOrder; lst.RootFolder.Update(); } }    

The Managed Metadata Service or Connection is currently not available. The Application Pool or Managed Metadata Web Service may not have been started. Please Contact your Administrator.

  I noticed this error when I logged to SharePoint farm; Meta Data service application. Tasks going to perform Get the Current Mapped Data Base for Managed Meta Data Service Backup Data Base and get the name Delete Meta Data Service Application with out Data Base Create a New Managed Meta Data Service with new Application Pool Change the Data base reference to old database When I googed I found few resolutions which didn’t work for me. so I tried a slightly different approach which worked for me. Get the Current Mapped Data Base for Managed Meta Data Service Go to central admin and navigate to Manage Meta Data Service properties to find out mapped data base. Then go to your database server and backup the database for recovery purposes. (this step is not mandatory but good for safe side) Delete Meta Data Service Application with out Data Base Create a New Managed Meta Data Service with new Application Pool When you creating specify a new data base name ( DB1 )...