Tuesday, September 2, 2014

Configure People Picker Settings in SharePoint 2013

The Problem isIf a web application is using Windows authentication and the site user directory path is not set, the People Picker control searches all the Active Directory to resolve users' names or find users, instead of searching only users in a particular organizational unit (OU).” Microsoft TechNet site said.

Below is the PowerShell and stsadm commands to Retrieve Users from a Specific OU in Active Directory:

Get current user account directory path for all Site Collections in a Web Application:
Get-SPSite -Limit All | Select Url, UserAccountDirectoryPath 

Get current service account directory path:
stsadm -o getproperty -url http://ServerName -pn peoplepicker-serviceaccountdirectorypaths 

Set service account directory path:
stsadm -o setproperty -url http://contosto -pn "peoplepicker-serviceaccountdirectorypaths" -pv "OU=Contoso-Admin,DC=Contoso,DC=com" 

Configure settings for Web Application (All Site Collections in  a Web Application):
$WebApp = "http://WebApp"
Get-SPWebApplication $WebApp | Get-SPSite -Limit All |ForEach-Object { Set-SPSite -Identity $_.Url -UserAccountDirectoryPath "OU=Contoso-Users,DC=Contoso,DC=com" }

Configure settings for a Site Collection:
Set-SPSite -Identity "http://Contoso/SiteCollection" -UserAccountDirectoryPath "OU=Contoso-Users,DC=Contoso,DC=com"

Monday, June 9, 2014

Configuring OneDrive for Business Use in SharePoint 2013


       1- Blocking File Types:
a. Central Administration > Manage Web Applications > The MySite Web Application > “Blocked File Types” from the ribbon.
b. Add the extension you want in a new line.

              2- Quota Limit Per User:
a. Create Personal Quota template.
b. Change Quota template for the Site Collection of the user
Central Admin > Application Management > Site Collections > Configure quotas and locks, or if you have large number of sites then use this PowerShell;

$SPWebApp = Get-SPWebApplication http://MySite

foreach ($SPSite in $SPWebApp.Sites)
{
    if ($SPSite -ne $null)
    {
        Set-SPSite -Identity $SPSite.url -QuotaTemplate "Quota Template Name"
        $SPSite.Dispose()
    }
}

             3- Set max upload size:
a. Central Admin > Manage Web Applications > The MySite Web Application > “General Settings” from the ribbon.
b. In the “Maximum upload size”, add the size.

Wednesday, June 4, 2014

Get SharePoint 2013 Site Collection Size Using PowerShell

I was trying to get the usage size for one of the SharePoint personal sites, and I ended up with this script.
The script is for getting all site collections usage compared to its maximum size, sorted by size of the Site Collections and the output to a HTML file.

$a = "<style>"
$a = $a + "TABLE{border-width: 1px;border-style: solid;border-color: black;border-collapse: collapse;}"
$a = $a + "TH{border-width: 1px;padding: 1px;border-style: solid;border-color: black;}"
$a = $a + "TD{border-width: 1px;padding: 1px;border-style: solid;border-color: black;}"
$a = $a + "</style>"

Get-SPSite -Limit All | select url, @{label="Size in MB";Expression={$_.usage.storage/1MB}},@{label="Capacity";Expression={$_.Quota.StorageMaximumLevel/1MB}} | Sort-Object -Descending -Property "Size in MB" | ConvertTo-Html -Head $a -title "Site Collections sorted by size" | Set-Content sc.html


Cheers,

Sunday, May 25, 2014

Hide SharePoint Calculated Columns


Note that you can't hide the SharePoint calculated columns by the normal way, you have to use PowerShell to do that !

$web = get-spweb http://SPWeb/Site/subsite $list = $web.Lists["list name"]
$field = $list.Fields["Column Name"] $field.ShowInDisplayForm = $false $field.ShowInEditForm = $false $field.ShowInListSettings = $false$field.ShowInVersionHistory = $false$field.ShowInViewForms = $false $field.ShowInNewForm = $false
$field.Update($true) $web.Site.Dispose()

Thursday, May 8, 2014

Access denied error while editing SharePoint 2013 List item.

While editing an item in a SharePoint 2013 List, I faced this error: "Access denied. You do not have permission to perform this action or access this resource" although the user has already an edit permission!!! 

I checked the ULS logs and the exception was "Original error: System.UnauthorizedAccessException: Access is denied. (Exception from HRESULT: 0x80070005 (E_ACCESSDENIED))"

After alot of searching, the solution was so simple, go to List settings > Advanced settings, and in the "Item-level Permissions" field, change "Create and Edit access:   Specify which items users are allowed to create and edit" to "  " ... then save



So Simple ... huh ?!

Monday, May 5, 2014

SharePoint 2013 Workflow gets Suspended

I was stuck with the error of Workflow gets suspended automatically.
Only Users with Full Control Permissions could make workflow start with no problems, but any user else face this problem.

RequestorId: eda26c74-95ef-2733-0000-000000000000. 
Details: An unhandled exception occurred during the execution of the workflow instance. 
Exception details: System.ApplicationException: HTTP 401 {"Transfer-Encoding":["chunked"],"X-SharePointHealthScore":["0"],"SPClientServiceRequestDuration":["200"],"SPRequestGuid":["eda26c74-95ef-2733-9cb7-5327536614d3"],"request-id":["eda26c74-95ef-2733-9cb7-5327536614d3"],"X-FRAME-OPTIONS":["SAMEORIGIN"],"Cache-Control":["max-age=0, private"],"Server":["Microsoft-IIS\/8.0"],"WWW-Authenticate":["NTLM","Basic realm=\"SharePoint.contoso.com\""],"X-AspNet-Version":["4.0.30319"],"X-Powered-By":["ASP.NET"],"MicrosoftSharePointTeamServices":["15.0.0.4420"],"X-Content-Type-Options":["nosniff"],"X-MS-InvokeApp":["1; RequireReadOnly"],"Date":["Mon, 05 May 2014 07:55:44 GMT"]} at Microsoft.Activities.Hosting.Runtime.Subroutine.SubroutineChild.Execute(CodeActivityContext context) at System.Activities.CodeActivity.InternalExecute(ActivityInstance instance, ActivityExecutor executor, BookmarkManager bookmarkManager) at System.Activities.Runtime.ActivityExecutor.ExecuteActivityWorkItem.ExecuteBody(ActivityExecutor executor, BookmarkManager bookmarkManager, Location resultLocation)

I made sure the User Profile Service is Configured and I did the full synchronization, and the user has a profile.

Finally nailed it by following steps:
1- Make sure the Workflow History List has the same permissions as your list, or grant a unique permission ,Contribute, for the users who will use the workflow.

2- Make sure the Workflow Tasks List has the same permissions as your list, or grant a unique permission ,Contribute, for the users who will use the workflow.

3- Check your workflow through SharePoint Designer and check permissions granted in any related list in the workflow ( That Solved my Problem, As I had another list which I get data from it and by mistake permissions there changed ) 


Usefull Links For Same Issue:


Wednesday, April 2, 2014

Get SharePoint SubSite List items via PowerShell

If you want to get all items in a specific list in Subsite, PowerShell can help:

Add-PSSnapin Microsoft.SharePoint.PowerShell –erroraction SilentlyContinue

$spWeb = Get-SPweb "http://sp/site"

$subsite = $spweb.Webs | where {$_.title -eq "SubSiteName"}
$lists = $subSite.Lists
$mylist = $lists | where {$_.title -eq "ListName"}
$mylist.GetItems() | select name


Tuesday, April 1, 2014

Sorry, We couldn't find your file. is it possible it was moved, renamed or deleted? SharePoint 2013,SkyDrive,OneDrive,Office Web Apps


I was trying to Edit a document -which hosted on SharePoint- in client side Word application , but I faced this error "Sorry, We couldn't find your file. is it possible it was moved, renamed or deleted? " followed by half of the URL.




After alot of trails I found the best ways to solve this issue, as it was not clear in most of the websites.

First:
Restart-Service AppFabricCachingService

Second:
You have to check the client side, as my problem was there, my Microsoft Office edition didn't allow me to open the file, Try to Repair it , or better to UnInstall then Install it again


Last:
Use the following PowerShell in your environment:


$config = (Get-SPSecurityTokenServiceConfig)
$config.AllowOAuthOverHttp = $true
$config.Update()


Also you can find more in the following links:
http://blog.sharepointsite.co.uk/2014/01/office-web-app-ran-into-problem-opening.html

http://social.technet.microsoft.com/Forums/sharepoint/en-US/31c6d108-e94d-41a1-99a9-570b3880eb33/sharepoint-2010-and-office-2013-cant-edit-documents

http://social.technet.microsoft.com/Forums/sharepoint/en-US/9662d5cf-0381-4c70-89cb-301ec1ea4439/sorry-we-couldnt-fine-your-file-is-it-possible-it-was-moved-renamed-or-deleted-skydrive?forum=sharepointgeneral

Monday, March 31, 2014

Emails from "workflow@noreply" - SharePoint 2013

It was a bug in the SharePoint 2013 that workflows send emails from Workflow@noreply ... and this was actually fixed in the SharePoint 2013 March PU, the engine now will send as the outbound email address configured in the Central Administration.

Download SharePoint Updates from

Tuesday, March 25, 2014

Profile Pictures no longer display in MySites after moving MySite URL or changing web application in SharePoint 2013



2-    Stop the User Profile synchronization service
Central Administration > System Settings > Manage Services on Server > User Profile Synchronization Service > Stop

3-    You must disable My Site cleanup timer job before you reset the synchronization database. (Otherwise, the job will delete all user profiles and My Sites from the farm) and Disable User Profile Incremental Synchronization timer job
Central Administration > Monitoring > Review Job Definition > My Site Cleanup Job > Disable
Central Administration > Monitoring > Review Job Definition > User Profile Service Application Name-User Profile Incremental Synchronization > Disable

4-    Stop the SharePoint 2013 Timer Service
SharePoint 2013 Management Shell (Run as Administrator) > net stop sptimerv4

5-    Reset the Synchronization Database
a-    SharePoint 2013 Management Shell (Run as Administrator) > Get-SPDatabase
Then find the ID of Sync DB (Default name is Sync DB).
b-    SharePoint 2013 Management Shell (Run as Administrator) > Get-SPServiceApplication
Then find the ID of User Profile Service App.
c-     Copy the following code and paste it into a text editor and save it as ResetSyncDB.ps1 :
$syncid = “<id from step a>”
$upaid = "<id from step b>"
$syncdb=Get-SPDatabase $syncid
$syncdb.Unprovision()
$syncdb.Status='Offline'
$upa= Get-SPServiceApplication $upaid
$upa.ResetSynchronizationMachine()
$upa.ResetSynchronizationDatabase()
$syncdb.Provision()
d-    In SharePoint 2013 Management Shell change the directory the where you saved the ResetSyncDB.ps1
Then type: ./ResetSyncDB.ps1

e-    Using SQL Server Management Studio, create a login in SQL Server for the User Profile synchronization service account (that is, the farm account). Then, in the synchronization database, create a database user who maps to the login and grant it access to the db_owner database role. (See How to: Create a SQL Server LoginHow to: Create a Database User, and Database-Level Roles)

6-    Start the SharePoint 2013 Timer Service:
SharePoint 2013 Management Shell (Run as Administrator) > net start sptimerv4

7-    Start the User Profile synchronization service
Central Administration > System Settings > Manage Services on Server > User Profile Synchronization Service > Start

8-    Reset IIS:
SharePoint 2013 Management Shell (Run as Administrator) > iisreset

9-    Create connections to the data sources.
a-    Open User Profile Service Application Settings
Central Administration > Application Management > Service Application > Manage Service Application> User Profile Service Application
b-    Create New Synchronization Connection
Synchronization > Configure Synchronization Connection > Create New Connection

10-  Import Users Photos from Active Directory Into SharePoint
a-    in the User Profile Service Application Page
People > Manage User Properties > Picture > Edit
b-    Scroll down to the Add New Mapping section.  Choose your AD data connection, select the thumbnailPhoto attribute and click Add, followed by OK to save the change. This maps the SharePoint picture property to a user’s photo attribute in AD.

11-  Enable My Site Cleanup Timer Job and User Profile Incremental Synchronization timer job
a-    Run two full profile synchronizations.
b-    Once the second profile synchronization is finished, open the SharePoint 2013 Management Shell (Run as Administrator)
Update-SPProfilePhotoStore -CreateThumbnailsForImportedPhotos 1 -MySiteHostLocation <MySiteURL>
c-     After the second profile synchronization is finished;
Central Administration > Application Management > Service Application > Manage Service Application> User Profile Service Application > Manage User Profiles
d-    Next to View, select Profiles Missing from Import
e-    In the Find Profiles box, type the domain for the profiles and then click Find.
f-     For each profile that is returned, check the originating directory service, such as Active Directory, for the status of that profile. If the status of any of the returned profiles in the directory is not disabled or is not deleted, do not enable the My Site cleanup timer job (Ignore next step only). Contact Microsoft support for more assistance. Otherwise, enable the My Site cleanup timer job.
g-    Enable My Site Cleanup Job
Central Administration > Monitoring > Review Job Definition > My Site Cleanup Job > Enable
h-    Enable the User Profile Incremental Synchronization timer job
Central Administration > Monitoring > Review Job Definition > User Profile Service Application Name-User Profile Incremental Synchronization > Enable


Refrences: