Skip to main content

Posts

SharePoint PowerShell - BackUps and Restore

SharePoint: PowerShell - BackUps and Restore Open Windows PowerShell using Run as admin PC> add-pssnapin Microsoft.sharepoint.powershell BackUp & Restore in SharePoint 2013 In SharePoint 2013, you can use Windows PowerShell functionality to perform a backup or restore process for the following items: Farm Site collection Configuration database Services List or document Farm BackUp Syntax: Backup-SPFarm -BackupMethod -Directory [-AssignmentCollection ] [-BackupThreads ] [-ConfigurationOnly ] [-Confirm [ ]] [-Force ] [-Item ] [-Percentage ] [-WhatIf [ ]] Another Syntax(This doesn’t backups actually, it shows the items to be backed up in this command): Backup-SPFarm -ShowTree [-AssignmentCollection ] [-ConfigurationOnly ] [-Confirm [ ]] [-Item ] [-WhatIf [ ]] Example: PS C:\Windows\system32> backup-spfarm -directory \\KSSHRPT01\FarmBackUp -backupmethod full PS C:\Windows\system32> backup-spfarm -directory \\KSSHRPT01\FarmBa...

SharePoint PowerShell to Manage Term Store / Add Terms using PowerShell

SharePoint PowerShell to Manage Term Store / Add Terms //get the term store $mysite = get-spsite “ http://yoursite:portnumber ” $taxonomySession = get-taxonomySession -site $mysite $termStore = $taxonomySession.TermStores[“Managed Metadata Service”] //now we will create the Term Store groups. Before we create any group we will check if the group already exists Example 1: if($termstore.groups["News Keys"] -eq $null) { $termstoregroup = $termstore.creategroup("News Keys");  $termstore.description = "News Group";  $termstore.addgroupmanager ("KS\spadmin"); $termstore.addcontributor ("ks\k.singh");$termStore.CommitAll();} This is not working as “ description ” is not an identified property. Example 2: if($termstore.groups["Main News Keys"] -eq $null) { echo "group is not there";  echo "group is there"; $termstoregroup = $termstore.creategroup("Main News Keys"); $terms...

All About Connecting to SharePoint Online using SharePoint Online PowerShell

Connecting to SharePoint Online using SharePoint Online PowerShell Set up the SharePoint Online Management Shell environment for SharePoint Online global administrators Perform the following: Install Windows PowerShell 3.0 from  Windows Management Framework 3.0 . Install the SharePoint Online Management Shell from the  Microsoft Download Center . Click Start>All Programs>SharePoint Online Management Shell. Run  Connect-SPOService . For example,  Connect-SPOService -Url https://contoso-admin.sharepoint.com -credential admin@contoso.com , where: Url is the URL of the SharePoint Online Administration Center. Credential is the user name to which you want to grant access to the SharePoint Online Administration Center site. Ref: https://technet.microsoft.com/en-us/library/dn568015.aspx Commonly faced issues when you start using Powershell for SharePoint Online. "The specified module '...

we're adding your app click here to cancel sharepoint 2013, Unable to install app for SharePoint

I configured the complete development environment for SharePoint 2013 app development (SharePoint Hosted) as per the recommended approach. Everything seems to work perfectly fine, after few days when I tried to deploy another app from VS 2013, the app deployment time goes up to 30 mins with error " Unable to install app for SharePoint ", and sometimes the deployment timer becomes endless in VS 2013. When I checked the app status on the target web application it always shows " we're adding your app click here to cancel ". This was too annoying and I can't even redeploy it from VS 2013 as it prompts versioning error. Finally I was able to resolve it, please preoceed with following steps. Go to the target web application, and click "Cancel" on the app. Once it is removed, go to the SharePoint Server on which SharePoint 2013 has been installed. Go to Windows Services: Windows from Start -> Administrative Tools. Alternatively you can go...

Session Id changes in ASP.NET MVC on every new page request

I faced and issue in ASP.NET MVC application where the value of SessionID variable changes on consecutive page requests. The reason is either you don't have a Global.asax file in your solution, or you have a global.asax in your solution without the definition of session end and session start. So the web server actually doesn't take care of session start and end event per application basis, and it generates a new key on every page request. You should have a Global.asax in your project and it shall have following two functions added:        protected void Session_Start()         { }         protected void Session_End()         { }      This should work perfectly....... Enjoy coding!

Generate a Pie Chart at runtime, C#, .NET

We can quickly write a function which returns a Pie Chart at runtime. Assuming that we are making a pie chart for the number of visitors/users from different countries, we will pass System.Data.DataTable as parameter to the function and it shall return a Chart object. Please add following namespaces to the page/class. using System.Windows.Forms.DataVisualization.Charting; using System.Drawing; using System.Data; Write the following function to get a Chart as return Parameter. You can pass a Datatable to the funtion with following schema, Datatable dt (Country Text, Users Int) Following is the function : protected internal Chart GetPieChart(DataTable dtChartData)         {             Chart pieChart = new Chart()             {                 Width = 800,                 Height = 800        ...