Tuesday, February 27, 2018

SharePoint Library Backup

To take only the SharePoint document library you can use the Export-SPWeb command by referencing the parameter ItemUrl.

You can even take backup of the single list or document. You have to use relative URLof the document library.
Example : By default document must referenced "/Document"

There other notable parameters there IncludeVersion , IncludeSecurity and NoFileCompression.

IncludeVersions includes all the versions of the document into backup file (.cmp )
IncludeSecurity includes all the permission of the document library in the backup file.
If you used the NoFileCompression then you need to specify the folder in the Path parameter, all the contents will extracted as data file (.dat) including the XML configuration of the library and its user details,Permission and if lookup column and version and other details..



example


export-spweb -identity "http://win-k6uc8ilel11/" -path "d:\docback\" -ItemUrl "/Shared Documents/" -IncludeVersions All -NoFileCompression -IncludeUserSecurity


Here is my output on my system


Alte
rnatively , you can also take the specific list or document library through Central Administration.
Click on Back up and Restore  on the opened page , under  Granular Backup click the link "Export a site or List"
Before proceeding this approach, create the network shared folder and give the write permission for the account that is being used for backup and restore.

Here is the output
Site or individual List backup through SharePoint Central Administration

Site or List Export - through SharePoint Central Administration

Backup Status  through SharePoint Central Administration



Friday, February 23, 2018

Site backup through Central Administration site

You can take the site collection back up through central administration site apart from using the BackUp-SPSite and Restore-SPSite PS command. The advantage of this approach is getting the status report while your site being backed up by the timer services.

 You can prefer this backup approach, if you are continuously taking the back up of huge site because It lets the administrator to have his/her network shared location which can be attached the high end storage medium (SAN). Before this, you need to create the shared folder location and set the access permission (Read and Write) for it.

It support the granular backup approach

You can also restrict the user permission over this folder by selecting the specific user or group.

 I have the small site collection at my machine and backed up through this approach.One should aware of the advantages and disadvantage by comparing the PS Commands BackUp and Restore. Once you backed up the site collection, you need to verify its integrity this where lack this approach. BackUp-SPSite has the parameter UseSQLSnapshot.


After successful backup task completion

Sunday, February 11, 2018

SharePoint Online SystemUpdate Vs Item Update

In CSOM / REST Api for SharePoint Online, We have new method for List Item called "SystemUpdate".

This is an attempt to bring the same functionalities of Server Side Object Model (SSOM) into SharePoint Online also.

This method is very useful, if you wanted to retain the Modified By and Modified Date on your SharePoint list for Auditing purpose when you migrate to SharePoint Online.

Its appropriate to understand the difference but List Item's Update method and System Update method.

If you want to update the fields Modified, Modified by then you can explicitly assign the new values to its field or you can also ignore when you call the method Item.Update().

If you wish to retain the Modified and Modified By column but wanted to update the rest of the fields, then you should use the Item's SystemUpdate method.


 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
var pwd = "yourpassword";
            var securePassword = new SecureString();
            foreach (char c in pwd)
            {
                securePassword.AppendChar(c);
            }

            var onlineCredentials = new SharePointOnlineCredentials("murugesan@codethinker.onmicrosoft.com", securePassword);
            var context = new ClientContext("https://codethinker.sharepoint.com/");
            context.Credentials = onlineCredentials;
            List oList = context.Web.Lists.GetByTitle("Friends");
            context.ExecuteQuery();
            ListItem item = oList.GetItemById(35);
            item["xm2s"] = "+91-xxx-7887-xxxx";
            item["Modified"] = DateTime.Now.AddDays(-7);
            item.SystemUpdate();
            context.ExecuteQuery();



Image 1

Earlier my record has old value for the column
Image 2
After I call the SystemUpdate method as above Image 1, It updates only the mobile not Modifield column.


Thursday, February 08, 2018

SharePoint PnP PowerShell on Windows 2008 R2

The new SharePoint PnP PowerShells for SharePoint Online is based on CSOM implementation and it can work for On-Premise versions of SharePoint 2013 and SharePoint 2016.

To install the module for SharePoint PnP, Your PowerShell engine version must be greater than 4.0.
You can use the below command to determine the current version of your PowerShell Engine.

$PSVersionTable.PSVersion

It will shows the major , minor, Builder and revision number.

If your major version is less than 4.0 , then you need to upgrade it to next major version.

You can download and install the "Windows Management Framework 5", link
https://www.microsoft.com/en-us/download/details.aspx?id=50395

In my case, I am using the Windows 2008 R2 SP1 and selected the relevant installation file from download page

Win7AndW2K8R2-KB3134760-x64.msu

Once you upgraded to next version, you need to install the Module for "SharePoint PnP PowerShell Online."

Post upgrade , I can install the SharePoint PnP PowerShell for Online.