Wednesday, July 1, 2015

Sharepoint Powershell - Enable logging - Verbose

To view the current Log Level in Sharepoint

Get-SPLogLevel

To create a new log file

New- SPLogFile

To set the ULS logging to Verbose


Set-SpLogLevel -TraceSeverity Verbose

To set the ULS logging to VerboseEx - Verbose Extended Logs- This will captured SQL queries in the log.


Set-SpLogLevel -TraceSeverity VerboseEx 

To set Eventlog along with trace log(ULS)

Set-SpLogLevel -TraceSeverity Verbose  -EventSeverity Verbose

To Clear the Log Level

Clear-SPLogLevel

To collect logs from all the servers based on Correlation


Merge-SPLogFile -Path "C:\Logs\Log.log" -correlation <correlation id>

To collect logs from all the servers based on date & time

Merge-SPLogFile -Path "C:\Logs\Log.log" -Overwrite -StartTime "mm/dd/yyyy hh:mm" -EndTime "mm/dd/yyyy hh:mm"


Sharepoint Powershell - Add bulk items to Sharepoint lists

cls

$webURL = "http://SiteURL"
$listName = "List_Name"


$web = Get-SPWeb $webURL
  
$list = $web.Lists[$listName]

#Add 1000 items to the list

for ($i=1;$i -lt 1001; $i++) {
$newItem = $list.Items.Add()

           #Add properties to this list item

           $newItem["Title"] = "Test Item"+ $i.ToString()
            $newItem.Update()

}

Sharepoint Powershell - To set master page

To find out which master page is currently applied


$web = Get-SPWeb http://siteurl
$web.CustomMasterUrl
$web.MasterUrl



To set a custom master page to the site

$web = Get-SPWeb http://siteurl
$web.CustomMasterUrl = "/_catalogs/masterpage/custom.master"
$web.MasterUrl = "/_catalogs/masterpage/custom.master"
$web.Update() 

Sharepoint 2013 Workflow Error Invalid JWT token

I had a Sharepoint 2013 Workflow in my site. 
I have configured Workflow manager correctly.

But my workflows weren't running fine. Its status is always "Workflow Cancelled"

When I click the details, it showed the below error

RequestorId: c4f69ed9-ce23-c0b4-b587-620ae350f156. Details: System.ApplicationException: HTTP 401 {"error_description":"Invalid JWT token. Could not resolve issuer token."}


Solution

Run the timer job "Refresh Trusted Security Token Services Metadata feed" to fix the issue

Sharepoint App deployment Error - The content database on the server is temporarily unavailable

When you try to deploy an app via Visual Studio, you might get the below error

The content database on the server is temporarily unavailable

Solution

Configure Managed Metadata service application correctly.

Also make sure you have the below service applications configured correctly

1. App Management Service Application.

2. Microsoft SharePoint Foundation Subscription Settings Service Application.

How to create a BCC Rule in Outlook

1. Open the email where your email is mentioned in BCC
2. Go to File -> Properties -> Internet headers
3. You can find the BCC entry at the end. Usually it would be X-MS-Exchange-Organization-Recipient-P2-Type: Bcc
4. Now create a Rule of type "with specific words in message header"