Saturday, August 25, 2018

QUERYING SHAREPOINT LOG FILES USING GET-SPLOGEVENT AND MERGE-SPLOGFILE

While working with SharePoint we need to query the SharePoint log files to check exact nature and cause of error. SharePoint logs provide us vital information to resolve with any issue. SharePoint provides us correlation id to get the details about the issue, but it is difficult some times to go and check the log files and manually find the error in log and get the cause, as log files are huge sometimes.
To resolve this we have some PowerShell cmdlets which enables us to search in the SharePoint log files. Some of them are Get-SPLogEvent and Merge-SPLogFile.

Get-SPLogEvent

We can use Get-SPLogEvent to query log files when either single server farm in place or we have knowledge on which server the error gets logged.So Get-SPLogEvent will query the logs in the same server where PowerShell command gets executed.

Get-SPLogEvent| ?{ $_.Correlation -eq [CORRELATION ID] }| select Area, Category, Level, EventID, Message | Format-List > [FILE PATH]
Get-SPLogEvent| ?{ $_.Correlation -eq “29b5c483-c48b-4ef2-b4b3-f5e29f635d31” }| select Area, Category, Level, EventID, Message | Format-List > C:\mergelog\log.txt

Merge-SPLogFile


Merge-SPLogFile enables us to query log files when we have multi-server farm  and we do not have idea where exactly the error got logged. i.e. timer service is running on four servers and the current timer request is served by Server1 then error get logged on server1.

Merge-SPLogFile -Path [FILE PATH] -Correlation [CORRELATION ID]
Merge-SPLogFile -Path C:\mergelog\log.txt -Correlation 29b5c483-c48b-4ef2-b4b3-f5e29f635d31

References


https://docs.microsoft.com/en-us/powershell/module/sharepoint-server/merge-splogfile?view=sharepoint-ps
http://cecildt.blogspot.com/2012/10/sharepoint-2010using-merge-splogfile-to.html

ADDING/REMOVING SERVICES TO DEFAULT APPLICATION PROXY GROUP IN SHAREPOINT USING POWER SHELL


By default, all Web applications are associated with the farm’s Default group of service application connections, although you can change this setting. You can also create one custom connection group for each Web application in the farm. You can change the service applications with which a Web application is associated at any time, and you can change the service applications that are included in the Default service application connection group.

$serviceAppProxy = Get-SPServiceApplicationProxy | where { $_.Name -eq “Name of the service” }
$proxygroup = Get-SPServiceApplicationProxyGroup | where { $_.FriendlyName -eq “[default]” }

Add-SPServiceApplicationProxyGroupMember -Identity $proxygroup -Member $serviceAppProxy

OR

Remove-SPServiceApplicationProxyGroupMember -Identity $proxygroup -Member $serviceAppProxy

Friday, August 24, 2018

SHAREPOINT 2013 , CONTROL WHETHER PDFS OPEN IN WORD WEB APP OR THE DEFAULT PDF READER


Background:

When users open a PDF file from a SharePoint document library that uses Office Web Apps Server, the default behavior is to open the PDF in Word Web App. If this isn’t the behavior you want, or if your users are having trouble opening PDFs on smartphones, you can use Windows PowerShell commands to make PDFs open in your default PDF reader instead.


The following command will fix the situation, where PDF documents will always open in the default PDF reader, but previewing won’t work anymore
Get-SPWOPIBinding –Application “WordPDF” | Remove-SPWOPIBinding -Confirm:$false

The following fixed all my problems  Your PDF documents will be opened in the default PDF reader, the preview will work and Word Web App will present the PDF documents in the “embedview”.

Get-SPWOPIBinding -Action “embedview” -Application “WordPdf”| Set-SPWOPIBinding –DefaultAction


If you change your mind and later want to have PDFs open in Word Web App again.:
Get-SPWOPIBinding –Application "WordPDF" | Remove-SPWOPIBinding -Confirm:$false
New-SPWOPIBinding –ServerName "Server.corp.Contoso.com" –Application "WordPDF" -AllowHTTP


Note : At times it would be a browser setting as well.

  1. Open Internet Explorer, and choose Tools > Manage Add-ons.
  2. Under Add-on Types, select Toolbars and Extensions.
  3. In the Show menu, select All Add-ons.
  4. In the list of add-ons, select Adobe PDF Reader.
  5. Click the Enable or Disable button (it toggles depending on the status of the selected add-on):
    • Enable sets the Adobe PDF Reader add-on to open PDFs in the browser.
    • Disable turns off the add-on so it does not open PDFs in the browser. 

References

https://blogs.technet.microsoft.com/office_resource_kit/2013/07/31/control-whether-pdfs-open-in-word-web-app-or-the-default-pdf-reader/
https://helpx.adobe.com/acrobat/using/display-pdf-in-browser.html



BROWSER FILE HANDLING IN SHAREPOINT

Browser File Handling was introduced into SharePoint 2010 as a security feature and the same applies to SharePoint 2013. When a user requests a file within SharePoint, the web server (IIS) will respond including the HTTP Response Header.

if Browser File Handling is set to Strict and the file (MIME) type accessed is not on the Web Applications trusted file (MIME) type list. This header works in conjunction with Internet Explorer (version 8 or higher) to prevent potential security risks when accessing files online and will stop files from being directly opened. 

Browser File Handling Options


There are two options for Browser File Handling – “Strict” and “Permissive”. 

1) “Strict” specifies the MIME types which are not listed in a Web Application’s AllowedInlineDownloadedMimeTypes property (more on this in a bit) are forced to be downloaded. 

2) “Permissive” specifies that the HTML and other content types which might contain script are allowed to be displayed directly in the browser. In other words, no matter what the type of content, if it lives within SharePoint, the file will open in your browser.

Managing Browser File Handling

It is important to note that a Browser File Handling property (BrowserFileHandling) exists in the following locations: 
  • Each Web Application has a Browser File Handling Property 
  • Each List has a Browser File Handling Property 
  • Each Document Library has a Browser File Handling Property 
  • Each IIS Server has a Browser File Handling Property that applies when Blob Cache is used on that server

Security Guidance and Overall Recommendation

It is recommended that for all Web Applications, you keep the default Browser File Handling setting – Strict. This promotes the best security practice and if you require MIME type exceptions, then add the specific MIME type to your Web Application’s AllowedInlineDownloadedTypes property list. 
For example, If you want to add PDF files to be opened directly, you can use PowerShell to add the PDF file type to the AllowedInlineDownloadMimeTypes.

To do this for single Web Applications, use the following line of code:

$webApplication = Get-SPWebApplication “http:/yourwebapplicationurl” $webAppApplication.AllowedInlineDownloadedMimeTypes.Add(“application/pdf”) 

$webApplication.Update()

This is the best practice for allowing the MIME type for a PDF in a SharePoint environment 

Note : At times it would be a browser setting as well.

Open Internet Explorer, and choose Tools > Manage Add-ons.
Under Add-on Types, select Toolbars and Extensions.
In the Show menu, select All Add-ons.
In the list of add-ons, select Adobe PDF Reader.
Click the Enable or Disable button (it toggles depending on the status of the selected add-on):

    • Enable sets the Adobe PDF Reader add-on to open PDFs in the browser.
    • Disable turns off the add-on so it does not open PDFs in the browser. 


References:
https://sites.google.com/site/sharepointhill/tutorials/mssp/open-file-forces-save-fix
https://helpx.adobe.com/acrobat/using/display-pdf-in-browser.html






Thursday, August 23, 2018

CO-AUTHORING DOCUMENTS IN SHAREPOINT 2013


Co-authoring in SharePoint helps multiple users to access a document or edit a document simultaneously. This functionality enhances collaboration, improves user experience and adoption of SharePoint.

CO-AUTHORING


The term  "Co-Authoring" in SharePoint is a feature that supports multiple (2 or more) users collaborating together on the same file/document at the same time.

File TYPE supported for CO-AUTHORing


The following file types can be Co-Authored.

  • Word
  • Excel (Supported only in Excel online / Excel Web App and Not in Client)
  • PowerPoint
  • OneNote
  • Visio 2013

OFFICE VERSION
SP2013 On-Premises
SharePoint Online
SP2010 On-Premises
Word 2013/2010
Yes
Yes
Yes
Word Web App
Yes
Yes
Yes
Excel 2013/2010
No
No
No
Excel Web App
Yes
Yes
Yes
PowerPoint 2010/2013
Yes
Yes
Yes
PowerPoint Web App
Yes
Yes
Yes
OneNote 2013/2010
Yes
Yes
Yes
OneNote Web App
Yes
Yes
Yes
Visio 2013
Yes
Yes
Yes
Visio Web App
No
No
No


Permission Levels Required FOR CO- AUTHORING


For co-authoring a document users must have permissions to access & edit the documents.

VERSIONING WITH CO-AUTHORING


When two or more users are editing a document at the same time, it saves the document for everyone once in a while (every minute or so), and whoever is the last one to make changes at the time of “save” – that user name is registered in the version history for that modified document.


MAXIMUM Recommended  CO-AUTHORING



As per the Software boundaries and limits for SharePoint 2013 This property only applies to Microsoft PowerPoint presentations and Microsoft Word documents.

Recommended maximum number of concurrent editors is 10. The boundary is 99. If there are 99 co-authors who have a single document opened for concurrent editing, each successive user sees a "File in use" error, and can only open a read-only copy. 

More than 10 co-editors will lead to a gradually degraded user experience with more conflicts, and users might have to go through more iterations to successfully upload their changes to the server. 
There is no upper limit to the number of users who can co-author Microsoft OneNote notebooks.

Reference