Archive for the 'SharePoint' Category

Security Token Service

Had a bit of a scare during a maintenance window.  Ran some updates on our SharePoint farm and after that one of the sites wasn’t coming up.  Kept getting a 503 error.  When I checked the event log, I found this error message:

An exception occurred when trying to issue security token: The HTTP service located at http://localhost:32843/SecurityTokenServiceApplication/securitytoken.svc/actas is unavailable.  This could be because the service is too busy or because no endpoint was found listening at the specified address. Please ensure that the address is correct and try accessing the service again later..

A quick search led to this article, and when I checked the AppPools, they were all stopped.

https://social.technet.microsoft.com/Forums/sharepoint/en-US/1bb454e8-d395-4059-8bc8-ccc74f999659/the-security-token-service-is-not-issuing-tokens-the-service-could-be-malfunctioning-or-in-a-bad?forum=sharepointgeneralprevious

Starting the AppPools fixed the problem.

SharePoint Documents are all checked out

I wanted to write a PowerShell script to check all the documents back in that had been checked out.  Turns out that is not as straight forward as I had hoped.

First search came up with this: Office Discarding Check Out Using PowerShell

Then when I tried to run the command (from the server console, because it doesn’t appear that you can just install the SP PowerShell Module on your desktop), I received the error below:

Get-SPWeb : Cannot access the local farm. Verify that the local farm is properly configured, currently available, and that you have the appropriate permissions to access the database before trying again.

That let me to this site: http://www.sharepointassist.com/2010/01/29/the-local-farm-is-not-accessible-cmdlets-with-featuredependencyid-are-not-registered/comment-page-1/#comment-1566

and this answer:

run sharepoint management shell with the service account
$db = Get-SPDatabase | Where {$_.Name -eq “SharePoint_ConfigDB”}
Add-SPShellAdmin “domain\user_to_add” -database $db

So I looked figured out how to accomplish that and moved on to writing the script for checking in files.  I ran out of time to work on this.  It will accomplish the task, but it isn’t as clean and efficient as I would like.

# Put your site root here
$TargetSite = "https://your.site.name/blah/blah/blah"
# The root folder that you want to start with
$TargetLibrary = "Shared Documents"

 

function LookForWorkFiles ($workFolder){
    Write-Host $workFolder
    # Get the SubFolder and work through it
    $wf = $Site.GetFolder($workFolder)
    # Get the files
    $FilesToProcess = $wf.Files
   
    Write-Host "How many files you ask?"
    Write-Host $FilesToProcess.Count
    If ($FilesToProcess.Count -le 0) {
        # If there aren’t any files, move on to the SubFolders
        Write-Host "No Files in $workFolder, checking for subfolders"
        }
    Else
        {
        # Check in all the files -NOTE this will cause an error for any
        # file that isn’t checked out. 
        foreach ($_ in $FilesToProcess) {
            Write-Host $_.Name
            $_.UndoCheckOut()
            $_.Update()
            }
        }
    Write-Host "Looking for Subfolders"
    Write-Host $wf.SubFolders
    foreach ($_ in $wf.SubFolders){
        Write-Host "SubFolders?"
        $Site.GetFolder($_)
        LookForWorkFiles $_
        }
    }
   
   
Write-Host "Beginning Script"
Write-Host $TargetSite
Write-Host $TargetLibrary

#Connect to the site
$Site = Get-SPWeb $TargetSite
#Get the Document Folder
$Folder = $Site.GetFolder($TargetLibrary)

foreach ($SPF in $Folder.SubFolders ){
    If ($SPF.Name -eq "Forms"){
        #the forms directory is for SharePoint, not for file management
        Write-Host "Skipping the Forms Directory"
        }
    Else
        {
        Write-Host $SPF.Name
        LookForWorkFiles $SPF
        }
    }

With this script, it is easier to use file management tools to move the files out of SharePoint. 

SharePoint Recycle Bin

I mentioned earlier (here) that we are clearing some old data out of a SharePoint site.  Aside from the various client side issues with trying to do that, you also have to figure out how to clean up SharePoint.  SharePoint has a multi-tier Recycle Bin.  There is a pretty good article about how it works in SharePoint 2010 (How the Recycle Bin Works in SharePoint) and the concept is pretty much the same for SharePoint 2013.

If you go to Site Settings you see something similar to this:

image

If you go down to the “Site Collection Administration” and click on “Recycle Bin” it takes you to the “End user Recycle Bin items”. 

You can change the view to “Deleted from end user Recycle Bin” and see the second level Recycle Bin contents:

image

Once it is gone from there, you can think about shrinking the database.

Here is where I learned what I just said:

http://sharepoint.stackexchange.com/questions/34980/claim-sql-server-space-after-content-deleted-from-sharepoint

I was asked to reduce a content DB recently, heres what I found. Whilst the customer was great in deleting content from their sites, SharePoint has a 2 stage recycle bin, so whilst the items were deleted from the site level recycle bin there was still 30 days left on the site collection recycle bin. So please ensure you check that and flush it.

Yes you’ll find that the DB will still be large at this stage. So as described above, use SQL Management studio and locate your content database in question, it won’t be the SharePoint configuration database as the example shows above but rather WSS_Content_something in all likelihood.

After that you find you will be able to shrink the database file (mdf). BUT! beware chances are your database is set to full recovery mode and when the shrink operation takes place all it will do is blow the transaction log out as many GB as you have removed. So the choice here is you might want to switch the DB into simple mode and then perform the shrink operation> I was lucky in that I had sufficient disk space when the shrink operation was taking place and removing 40GB blew the logs out 40GB, once that was complete the mdf was then shrunk 40GB. After this I switched the DB to simple mode and shrank the log file, then changed it back to full.

One word of warning.  When you go delete that data, if it is a lot of data, SharePoint becomes a bit less responsive.  You may want to do that outside of normal working hours.

Moving data out of SharePoint

We have a SharePoint site that we used to store some data.  It was used at remote locations to be able to “map a drive” and interact with data.  There is some old data in the site now, and we needed to move it off.  I hadn’t messed with it in a while and forgot several of the little issues that come up when you use this solution.

First SharePoint has a file size limit, and an item count limit.  I believe the file size limit is 50MB by default, but I don’t remember for sure (SharePoint 2010 and 2013).  Also, from the client side there is a registry entry that you have to change in order to download files larger that 50 MB.  I found that answer here:

 http://answers.microsoft.com/en-us/ie/forum/ie8-windows_xp/error-0x800700df-the-file-size-exceeds-the-limit/d208bba6-920c-4639-bd45-f345f462934f

FileSizeLimitInBytes is set to 5000000 which limits your download so just set it to maximum! (this is client side btw on windows 7)

HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\WebClient\Parameters

  1. Right click on the FileSizeLimitInBytes and click Modify
  2. Click on Decimal
  3. In the Value data box, type 4294967295, and then click OK. Note this sets the maximum you can download from the Webdav to 4 gig at one time, I haven’t figured out how to make it unlimited so if you want to download more you need to split it up.

hopefully this helps for you guys!

The other issue is that PDFs tend to get checked out and stay checked out.  So when you are trying to move the files, you have to make sure they are all checked back in first.

Restoring Deleted Items in SharePoint

We are using SharePoint Document Libraries for some projects now.  The users are mapping the Document Library as a mapped drive.  Users are also creating and deleting files.  For the Projects site, the recycle bin settings are default:

Items in the Recycle Bin remain there until you decide to permanently delete them from your Web site, or until the items are permanently deleted after a set number of days, which is based on a schedule defined in Central Administration. When you delete an item from a Web site, the item is sent to the site’s Recycle Bin. If you click Recycle Bin on the Quick Launch, you can see all of the items that you’ve deleted from your site. You can either restore or delete the item from the Recycle Bin. When you delete an item from the Recycle Bin, the item is sent to the Site Collection Recycle Bin.

Recycle Bins

Callout 1 End-user deletes the Agenda document from a document library.

Callout 2 The document is moved to the Recycle Bin for the site, where people can restore it or delete it.

Callout 3 If the file is deleted from the site Recycle Bin, it is sent to the Site Collection Recycle Bin, where an administrator can restore it or delete it permanently.

It should be possible to restore user deleted items for up to 30 days.  This requires Site Administrator privileges if it isn’t in the users recycle bin.

http://office.microsoft.com/en-us/windows-sharepoint-services-help/view-restore-or-delete-items-in-the-recycle-bin-of-a-sharepoint-site-HA010021434.aspx