Sunday, April 27, 2014

Differences between CSOM and SSOM

The core differences between Client Side Object Model (CSOM) API and traditional Server Side Object Model(SSOM)

Further reading at http://intelliview.blogspot.co.uk/2014/10/sharepoint-2013-client-object-model.html
  • Administration related task such as site back,service application management and workflow related tasks can be done only through Server Side object model. 

  •  Site branding such as managing the master page,theme and CSS file cannot be done in Client Side object model. 

  •  Request Batching (Series of Request for data retrieval on the Client context) submitted to the server in a single request.This can be done using Client side object model and REST API.

Thursday, April 24, 2014

Syntaxhighlighter testing

protected void button_clicked(Object obj,EventArgs e)
{
foreach(String line in Story)
{
Response.Write("Line:"+ line);
}
}

Site backup and restore programmatically - SharePoint 2013

Site backup and restore programmatically in SharePoint 2013 can be simple just like that in two lines of code.
To run this code successfully you must have the permission on the SharePoint farm and site collection administration.

Create the Shared folder on your server and set the permission to "Everyone" on the folder.

SPSecurity.RunWithElevatedPrivileges(delegate()
 {
 SPWebApplication webApps = SPWebApplication.Lookup(new Uri("http://webapplicationUrl/"));
SPSiteCollection sites = webApps.Sites;
 sites.Backup(SPContext.Current.Site.Url, @"\\Server\\SiteBackUp\\backup.dat", false);
 });
After this ensure your backup file work as expected by restoring the site using powershell command Restore-SPSite -Identity http:/site/sites/restoreSite -Path d:\backup.dat -DatabaseServer database serverName -DatabaseName WSS_Content -Force Alternatively you can also use Restore method of SPSiteCollection method. SPSiteCollection Class

Managing the unused site in SharePoint 2013

Before starting of reading this,its best to know how to identify the inactive site ? There is couple of properties available for SPSite class.


  1. LastContentModifiedDate
  2. LastSecurityModifiedDate

         using (SPSite site = new SPSite(SPContext.Current.Site.Url))
            {
                DateTime lastContentModified = site.LastContentModifiedDate;
                DateTime lastSecurityModified = site.LastSecurityModifiedDate;
            }

So you can decide to keep the inactive site in the server or not based on the number of days.
Unused site collection in SharePoint 2013 can be deleted from the server to free up some resources.
Before deleting the unused site collection, farm admin need to configure the outgoing email setting for sending the email notification to Site Owner. [Note: - Not Site collection administrator]
See the difference between Site Collection Administrator Vs Site Owner.
Farm admin can define to delete the SC then he need to determine what will be the waiting period for site collection to be declared as inactive.
He can schedule the email notification to SCA at daily, weekly and monthly intervals.
SharePoint 2013 restricts the number of email notices to be sent to site owners. Below table depicts the limitation on number of emails can be sent on chosen interval.

Interval
Min
Max
Daily
28
164
Weekly
4
24
Monthly
2
6

The email will contain the link to capture the site owner acknowledgment over his/her site status. If site owner does not respond to the email notification on specified duration then site will be deleted automatically. This feature must be turned on by the member of farm administrator group.
If site collection configured to delete automatically, it’s advisable to have site backup before site being deleted by the timer job.
If Site Owner specified the secondary site owner while creating the site then secondary site owner also will receive the email notices about the site deletion.
Site collection can be deleted by giving intimation of 30 days duration as minimum and maximum 365 days.
CAàClick on Application Management header linkà under site collection à Site Use Confirmation and Deletion.
Screen looks like this.

8

Another way is to delete the site create the site policy as seen in this post