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




Monday, July 09, 2018

SHAREPOINT 2013 NEWSFEEDS NOT WORKING – Microsoft.Office.Server.Microfeed.MicrofeedException. Internal error code: 55.

Problem Statement

 MySites newsfeeds don’t work and SharePoint returned the following error: The operation failed because the server could not access the distributed cache. Internal type name: Microsoft.Office.Server.Microfeed.MicrofeedException. Internal error code: 55. Contact your system administrator for help in resolving this problem.

Solution

Find the account for the Feed Cache service that the application pool was running on.   Add this account to the User Profile service application and provide full control and that fixed the issue. 




Sunday, July 08, 2018

SHAREPOINT 2013 HTTP/1.1 200 OK SERVER: MICROSOFT-IIS/8.0 CONNECTION: CLOSE ERROR


Problem Statement:
Open a site collection then I got error as

HTTP/1.1 200 OK

Server: Microsoft-IIS/7.5

Connection: close

Proposed Solutions



At first it appears to be a fairly minor error. So I performed an IISRESET to try and see if a restart of the web services would fix the problem. Unfortunately this did not fix the issue.
I did notice however that site collections within the Web Application were working fine for example if I went to http://sharepoint/sites/aka the site was functioning correctly and all the information was there. So what ever had happened had just affected the main site.
After a lot of researching about the error across the internet I found a large number of possible fixes including

  • Creating a new site collection would fix the issue.
  • Checking that the workstation service was running?!?
  • Changing the authentication type.
  • Removing and re-attaching the content database.
  • If any managed path location which is modified



NINTEX FORM - CUSTOMIZE THE FORM FIELDS USING CSS/JS


Users can either use the default css provided by Nintex or create their own custom CSS add them at the end of "Custom CSS" section of "Form Settings" or create a .css file, add it to site assets and refer in "Advanced --> Custom CSS includes" section of "Form Settings".

In each forms control under the controls settings, click on Formatting section and there user can apply the CSS class

NOTE: No support for custom CSS and JS support to responsive forms, it is only available in classic forms




















Reference







NINTEX FORMS - USING THE LOOKUP FUNCTION

      Nintex Forms offers many great features for designing and customizing your SharePoint forms. There are times when you need to pull in data to your forms from other sources, including other SharePoint lists.  One way to accomplish this is to use the Lookup function, which allows you to retrieve data from a column within a SharePoint list and display that data on a form or use it in a formula. The Lookup function can be utilized within a Calculated Value control, Form Variable, or Rule.

      Here’s the syntax for configuring the Lookup function:

lookup(List Title, Column to filter on, Value to filter on, Output column)
1.      List Title – The title of the list that contains the data you are retrieving.  The list can be in the current site or another site.  To configure with a list on another site, start by prepending the List Title with the server relative URL path of the site and then delimit the list title with a pipe (|) symbol.  For example, “/sites/siteCollection/siteName|ListTitle”.
2.      Column to filter on – The name of the column in the list that you want to filter on.  This column is used to filter which list items are returned as matches occur against the third parameter.
3.      Value to filter on – The specified value that is compared against each item in the list.  Be sure to use a Named Control instead of an item in the Item Properties tab for this value.
4.      Output column – The column name in the list from which the data is retrieved.

      References
      

      

ADD MICROSOFT.SHAREPOINT.POWERSHELL SNAP-IN TO ALL POWERSHELL WINDOWS

Problem Statement:

 Whenever I wrote Sharepoint reIated powershell script I had to constantly add the line Add-PSSnapin 
"Microsoft.SharePoint.PowerShell" at the top of every script I wrote, and I wanted it to just already be there like it is when I run the SharePoint Management Shell. 

Solution:


Add the snap-in code to the PowerShell profile.
Open up PowerShell ISE and run the following to create a profile script if one doesn’t exist and edit it in the ISE:


if (!(test-path $profile.AllUsersAllHosts)) {new-item -type file -path $profile.AllUsersAllHosts –force}
powershell_ise $profile.AllUsersAllHosts


That will open a new tab in PowerShell ISE allowing you to edit profile.ps1.  If you simply execute $profile.AllUsersAllHosts, you will see the path where this file is stored (be default it is C:\Windows\System32\WindowsPowerShell\v1.0).

In PowerShell ISE, you will now have a new tab where you can edit this file.  In that new tab, add the following code and then save the file.


$ver = $host | select version
if ($ver.Version.Major -gt 1) {$host.Runspace.ThreadOptions = "ReuseThread"}
if ((Get-PSSnapin "Microsoft.SharePoint.PowerShell" -ErrorAction SilentlyContinue) -eq $null)
{
    Add-PSSnapin "Microsoft.SharePoint.PowerShell"
}


Now, close PowerShell ISE and then open it again.  It will take a little longer than usual to open the window because it is executing the code from Profile.ps1 and adding the Microsoft.SharePoint.PowerShell snap-in.  To test it, run a command such as Get-SPFarm.