Monday, December 16, 2013

Facts About SharePoint Log and Correlation ID

Facts About SharePoint Log and Correlation ID

Facts :

1- GUID attached to your logs/error messages when something happens.
2- Correlation ID is used per request-session.
3- You can find the Log files inside
       C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\14\LOGS\


How To Search Inside SharePoint Log:

1- Using Power Shell :

Short Description
get-splogevent | ?{$_Correlation -eq "<GUID>"}

Details
get-splogevent | ?{$_.Correlation -eq "<GUID>"} | select Area, Category, Level, EventID, Message | Format-List

If you want the Error Detail to be put into a text or log file instead :
get-splogevent | ?{$_.Correlation -eq "<GUID>"} | select Area, Category, Level, EventID, Message | Format-List > C:MyErr.log

2- Using SQL queries : 
   In your logging DB (usually called WSS_Logging and could be called something else)
   there is a view called "ULSTraceLog" which you can query :

select [RowCreatedTime], [ProcessName], [Area], [Category], EventID, [Message]
from [WSS_UsageApplication].[dbo].[ULSTraceLog]
where CorrelationId= 'C5CCAM46-38h9-5B5D-BN44-5242B8C3M2M3'

3- Get the current Correlation ID by using code :
     [DllImport ("advapi32.dll")]
     public  static  extern  uint  EventActivityIdControl(uint  controlCode,ref  Guid  activityId);
     public  const  uint  EVENT_ACTIVITY_CTRL_GET_ID = 1;
     public  static  Guid  GetMyCurrentCorrelationID()
     {
         Guid  g = Guid .Empty;
         EventActivityIdControl(EVENT_ACTIVITY_CTRL_GET_ID, ref  g);
         return  g;
     }


naadydev@gmail.com

SharePoint 2010 : Microsoft sharepoint is not supported with version 4.0.30319.18052 of the microsoft .Net Runtime

SharePoint 2010 :  Microsoft sharepoint is not supported with version 4.0.30319.18052 of the microsoft .Net Runtime

Solution :
           1- Open PowerShell :
           2- powershell.exe -version 2.0
           3- Add-PSSnapin Microsoft.Sharepoint.Powershell



naadydev@gmail.com


Thursday, December 12, 2013

Fix: Access denied error when using SPWebApplication.Update()

Fix: Access denied error when using SPWebApplication.Update()

Reason : 
             The reason was that the Remote Administration Access Denied was true by default.

Solution:
             To disable Remote Administration Access Denied using Powershell:
-------------------------------
 $contentService = [Microsoft.SharePoint.Administration.SPWebService]::ContentService
$contentService.RemoteAdministratorAccessDenied = $false
$contentService.Update()
--------------------------------