Thursday, July 20, 2017

Find SharePoint Correlation-ID with Powershell

Today when I entered into my machine , I was getting correlation ID . I don't know where my team members changed the location of Log files from Hive 15 folder .

Then I used below by opening SharePoint Powershell command as administrator to fetech the log files 

Step 1: Merge-SPLogFile -Path ".\error.log" -Correlation "Correlation-ID"
Step 2: dir *.log

Tuesday, June 20, 2017

Powershell to find total documents in Farm

Get-SPSite -Limit All | Get-SPWeb -Limit All | % { $_.Lists} | ? { $_ -is [Microsoft.SharePoint.SPDocumentLibrary] } | % { $total+= $_.ItemCount} ; $total

Count total documents from all document libraries of Site Collection using PowerShell


$site = New-Object Microsoft.Sharepoint.SPSite("https://site collection name or any site");  # Get spsite object
$body = "Site Collection Document Audit for $site`r`n"
foreach ($web in $site.AllWebs)
{
    $url = $web.Url;
    $body = $body + "Web: $url`r`n";
    $lists = $web.GetListsOfType(1);   #Get all document libraries;
    foreach($list in $lists)
    {
       
        $count = $list.Items.Count;
        $title = $list.Title
        $body = $body + "        -  $title :$count items.`r`n"
    }
    $body = $body + "`r`n";
    write-host $body
$web.Dispose();
}
$site.Dispose();

Monday, June 12, 2017

Unexpected Exception in SPDistributedCachePointerWrapper::InitializeDataCacheFactory for usage 'DistributedLogonTokenCache

SharePoint 2013 / 2016  uses app-fabric to host couple of cache cluster in this process the services of App fabric might get stooped due to it's time line . Also need to rights

Solution 1 :  Start the App Fabric cahcing services in Services.msc and reset IIS

Solution 2: Extend the cache Settings with powershell

$set = Get-SPDistributedCacheClientSetting -ContainerType DistributedViewStateCache
$set.requestTimeout = “100” # normally it’s 20ms
$set.channelOpenTimeOut = “100” # normally it’s 20ms
# maybe change the other values too
Set-SPDistributedCacheClientSetting -ContainerType DistributedViewStateCache $set

Solutions 3: The server farm account, which is also referred to as the database access account, is used as the application pool identity for Central Administration

  • Membership in the WSS_ADMIN_WPG Windows security group for the SharePoint Foundation 2013 Timer service.
  • Membership in WSS_RESTRICTED_WPG for the Central Administration and Timer service application pools.
  • Membership in WSS_WPG for the Central Administration application pool.
Solution 4 : Use the commands to stop ,remove and start the distributed service

Stop-SPServiceInstance
Remove-SPDistributedCacheServiceInstance
Add-SPDistributedCacheServiceInstance

Friday, May 12, 2017

Windows Server AppFabric is not correctly configured.You Should uninstall Windows Server Appfabric and reinstall it using The SharePoint Products Preparation Tool.


Dear All,

While installing sharepoint 2013 & 2016 I have been facing annoying error which is below screenshot
72

We all knew that we it shows frustrated repeated error

Windows Server AppFabric is not correctly configured.You Should uninstall Windows Server Appfabric and reinstall it using The SharePoint Products Preparation Tool

I tried below 2 ways which helped me to solve the issue
Solution 1 : 

$SharePoint2013Path = "D:\Appl\SP"
Start-Process "$SharePoint2013Path\PrerequisiteInstaller.exe" /KB2671763:$SharePoint2013Path\PrerequisiteInstallerFiles\AppFabric1.1-RTM-KB2671763-x64-ENU.exe
Start-Process "$SharePoint2013Path\PrerequisiteInstaller.exe" /AppFabric:$SharePoint2013Path\PrerequisiteInstallerFiles\WindowsServerAppFabricSetup_x64.exe

Solution 2:
  • Move WindowsServerAppFabricSetup_x64.exe to drive C:/
  • Type the following command line in PowerShell.

    \WindowsServerAppFabricSetup_x64.exe /i CacheClient,CachingService,CacheAdmin /gac
     
     
                                    or
         .\WindowsServerAppFabricSetup_x64.exe /i /gac



Sunday, October 9, 2016

Get Login UserName fon Preload of SharePoint List "NewForm.aspx"

Step 1:  Downlaod SPServices.js latest files

Step 2: Place the J.s filed into Asset Libraries

Step 3 :Replace the url of the SP.Services to your Side from below yellow color highlighted url

Step 4: Change the first parameter Name which should be the column from "Title" to  your  list column name in the function
SetUserFieldValue("Title",loginName);

<script src="https://ajax.microsoft.com/ajax/jQuery/jquery-1.4.2.min.js" type="text/javascript"></script>

<script src="/SiteAssets/jquery.SPServices-2014.02.js" type="text/javascript"></script>


<script type="text/javascript">

$(document).ready(function () {

 var loginName= $().SPServices.SPGetCurrentUser();

SetUserFieldValue("Title",loginName);



function SetUserFieldValue(fieldName, userName) {

 var _PeoplePicker = $("div[title='" + fieldName + "']");

 var _PeoplePickerTopId = _PeoplePicker.attr('id');

 var _PeoplePickerEditer = $("input[title='" + fieldName + "']");

 _PeoplePickerEditer.val(userName);

 var _PeoplePickerOject = SPClientPeoplePicker.SPClientPeoplePickerDict[_PeoplePickerTopId];

 _PeoplePickerOject.AddUnresolvedUserFromEditor(true);

}

});
</script>