Paul Liebrand's Weblog

Welcome to my blog mainly about SharePoint

Skip to: Content | Sidebar | Footer

Google Search

SharePoint: Cannot complete this action. The URL is invalid. It may refer to an nonexisten file or folder, or refer to a valid file or folder that is not in the current Web

12 June, 2014 (09:35) | SharePoint | By: Paul Liebrand

After we recently upgraded our SharePoint environment we had a few pages that would throw the error whenever we attempted to check it in or discard checkout:

“Cannot complete this action. The URL ‘Pages/default.aspx’ is invalid. It may refer to a nonexistent file or folder, or refer to a valid file or folder that is not in the current Web”

This error would occur no matter what account you use to resolve this issue. The following PowerShell script can be used to get around this issue:

$web = Get-SPWeb http://web
$list = $web.Lists["ListName"]
$file = $list.GetItemById(1); // ID of the file with the issue
$file.File.UndoCheckout()
$file.File.Checkin("")

 

You may also see the following error message appearing in the ULS logs:

"SqlError: ‘Arithmetic overflow error for data type tinyint, value = -112.’ Source: ‘.Net SqlClient Data Provider’ Number: 220 State: 2 Class: 16 Procedure: ‘proc_UncheckoutDocumentInternal’ LineNumber: 266 Server: ‘SQL Server Name’"


Post to Twitter Post to Delicious Post to Digg Post to Facebook Post to Reddit

PowerShell to cancel all SharePoint solution deployments

13 May, 2014 (09:40) | SharePoint | By: Paul Liebrand

The following PowerShell script will cancel all solutions that are waiting to be deployed without having to go to each one and cancel it:

Get-SPTimerJob | ? {$_.Name -like "Solution-Deployment*" } | % { $_.Delete() }


Post to Twitter Post to Delicious Post to Digg Post to Facebook Post to Reddit

SharePoint 2013 Upgrade-SPSite Only Doing One at a Time

19 April, 2014 (09:15) | SharePoint | By: Paul Liebrand

Just a word of caution if you are upgrading site collections in SharePoint 2013. Many examples will show you the following PowerShell command if you want to upgrade all your site collections:

Get-SPSite -Limit All | Upgrade-SPSite -VersionUpgrade –Unthrottled

Be wary that this will literally execute 1 site collection at a time.  By default, SharePoint will allow 10 concurrent upgrades for site collections.  If you want to take advantage of the concurrency SharePoint offers, I would recommend running the following:

$sites = Get-SPSite -Limit All | ?{$_.CompatibilityLevel -eq 14}
Write-Host $sites.Count

foreach ($site in $sites)
{
    Upgrade-SPSite -Identity $site -VersionUpgrade -QueueOnly
}

You can then monitor the progress using the following:

Get-SPContentDatabase | Get-SPSiteUpgradeSessionInfo -ShowInProgress -ShowFailed | ft

I hope this helps!


Post to Twitter Post to Delicious Post to Digg Post to Facebook Post to Reddit

SharePoint 2013 Edit vs. Contribute Solution

18 April, 2014 (18:29) | SharePoint | By: Paul Liebrand

I recently wrote an article about how Microsoft added a new permission level called Edit that allows people to modify more things than the old contribute permission level. The solution is simple – change the permission level of the member group to Contribute and then delete the Edit permission level.

I wrote a PowerShell script that will enumerate all your web applications, site collections, and webs to change the setting for you.

You can either run it against all web applications or for a specific site. You can download the script here.

Once you have the script loaded, you can run it in the following two ways:

All Web Applications, Sites, and Webs

Measure-Command {
    Get-SPWebApplication  | Fix-PLEditContribute
}

Specific Site/Webs

Measure-Command {
    Get-SPSite http://test/sites/site | Fix-PLEditContributeSite
}

Enjoy!


Post to Twitter Post to Delicious Post to Digg Post to Facebook Post to Reddit

SharePoint 2013 Document Libraries Missing View Selectors and Search Box after Content Database Upgrade

14 April, 2014 (21:33) | SharePoint | By: Paul Liebrand

This is probably the most major problem we ran into during our upgrade from SharePoint 2007 to SharePoint 2013 using the Content Database Attach method. We spent a great deal of time trying to understand this problem and why it was so intermittent and I am glad we found a resolution and the problem is behind us now.

At the top of a SharePoint 2013 document library, you will see a view selector and a search box (“Find a file”):

3-18-2014 8-09-53 AM

We noticed this whole section was missing from most of our document libraries after the upgrade:

 3-18-2014 8-11-56 AM

If we deleted the web part and added it back again all the functionality returned. After we spent a great deal of time with Microsoft, they eventually pointed us to the following MSDN Gallery page written by Christopher Buchholz called “Copy or Replace List Views” (http://gallery.technet.microsoft.com/office/Copy-or-Replace-List-Views-91178033). Unfortunately the script provided by Christopher did not work as supplied because it was built with some dependencies on some custom functions he wrote that were not supplied.

As you can see, the first paragraph of the page reads:

You may find the need to mass-update list views, especially after performing a migration to SharePoint 2013. This set of functions will search and replace document library views for any web or site collection, or let you override and replace views for a specific list.

This described our symptom exactly!

I modified the script slightly to make it run in any environment. The script is available to download here: http://1drv.ms/1hPPgcE

One you have the script downloaded, you can execute the following commands to loop through all your web applications and fix all the views that have this problem:

. .\ViewFix.ps1
Measure-Command {
    Get-SPWebApplication | Fix-SPWebApplication #-verbose uncomment for verbose
}

Public Service Announcements

Public Views

The original script essentially converted Personal views to Public views.  My script has been modified to just log personal views as it is running.  If the users want the functionality back, you can have them delete their personal view and simply create a new one.

View IDs

This process will completely change your view ID’s.  For the average environment this probably will not be an issue but if anyone is using a link that contains the old view ID, those links will not work properly.

When does the view ID become part of the URL?

If you navigate to a document library and then click on a folder within that document library, take note of the URL. It will look something similar to this:

&FolderCTID=&View=%7b76916226%2d876F%2d469E%2d9A74%2d67E89593B7B1%7d">http://company.portal/Site/AppDoc/Forms/AllItems.aspx?RootFolder=<some junk>&FolderCTID=&View=%7b76916226%2d876F%2d469E%2d9A74%2d67E89593B7B1%7d

Since the link is referring to the View in the query string it will try load that view when the user clicks on it. If it cannot find the view, it simply redirects to the root library.


Post to Twitter Post to Delicious Post to Digg Post to Facebook Post to Reddit

Query SharePoint Database for Project Server Fields and Content Types

13 April, 2014 (22:33) | Project Server 2007, SharePoint | By: Paul Liebrand

We are in the process of upgrading from SharePoint 2007 to SharePoint 2013 and as part of that upgrade, we are removing Project Server. The problem is that there was many areas where the Project Server fields and content types were still be referenced which would cause an issue in SharePoint 2013.

You can use the following two queries to find the Project Server fields and Content Types in your SharePoint 2007 environment prior to the upgrade.

These two queries will loop through all your content databases looking for the specific data.

Fields

sp_msforeachdb 'use [?]; 
select ''?'' as ContentDB,
w.fullurl,
al.tp_Title,
al.tp_ItemCount,
case when tp_DeleteTransactionID = 0x
then ''Current''
else ''In Recycle Bin''
end as Status
from AllLists al with (nolock)
join webs w with (nolock)
on al.tp_WebId = w.Id
where (
tp_Fields like ''%413213C2-3E91-4dc8-9D47-216B83AB8027%''
or tp_Fields like ''%21DEA678-5F82-4916-A658-89328C8DA88D%''
or tp_Fields like ''%245BE2EA-C915-468d-A5BA-AABA920DF6C7%''
or tp_Fields like ''%1ACA4095-08D2-474c-A0D9-98F4DE1C2E8F%''
or tp_Fields like ''%C1F4CE7E-7643-4553-8889-4B988CED38CC%''
or tp_Fields like ''%57CFB7A0-55E6-45cb-AB01-314F36DAF2C2%''
or tp_Fields like ''%E9D56B99-1EAC-4f1d-A578-C55FE7B8603A%''
or tp_Fields like ''%6E86422F-6225-4aae-8C11-FB5B911C163F%''
or tp_Fields like ''%373C7DDE-32BC-4b09-B89B-82468AF3F8D6%''
or tp_Fields like ''%D023AF40-7785-43e5-BA80-E2027D82EF7D%''
or tp_Fields like ''%68865259-4598-4478-A616-25421406A322%''
or tp_Fields like ''%6B66AEEA-9F57-48e0-93CB-BD768C0A5751%''
or tp_Fields like ''%1C36B500-FE66-446d-A4F3-E9ECCD40DE5E%''
or tp_Fields like ''%21DEA678-5F82-4916-A658-89328C8DA88D%''
or tp_Fields like ''%C3CC99CC-BBCE-43f3-A2A3-BCA7535E23F0%''
or tp_Fields like ''%CE092E5C-02EA-4d56-A608-134B60C6EFD8%''
or tp_Fields like ''%CA8F9DC8-8CCC-485a-ADCC-B0E99C7F5E41%''
or tp_Fields like ''%FC23C839-B668-4aec-AAC7-6453014CC6B7%''
or tp_Fields like ''%DE524831-8D11-4c6a-A9AB-0D23DC58D9C3%''
or tp_Fields like ''%C07DE636-94DE-4af8-A97A-58F2388AD678%''
or tp_Fields like ''%77FDCA8D-B426-4a04-AD1E-957DA9EB13B2%''
or tp_Fields like ''%079DD49E-C905-4734-9CFB-DE5B99BA7151%''
or tp_Fields like ''%67DA35BA-6CEA-4fdc-A3CA-72A20A0C3A9A%''
)'
 

Content Types

sp_msforeachdb 'use [?]; 
select distinct ''?'' as ContentDB,
w.fullurl,
al.tp_Title,
al.tp_ItemCount,
case when al.tp_DeleteTransactionID = 0x
then ''Current''
else ''In Recycle Bin''
end as Status
from AllLists al with (nolock)
join webs w with (nolock)
on al.tp_WebId = w.Id
where (
tp_ContentTypes like ''%0x010074416DB49FB844b99C763FA7171E7D1F%''
or tp_ContentTypes like ''%0x0101008A98423170284beeB635F43C3CF4E98B%''
or tp_ContentTypes like ''%0x0100DD9A1416BBC74a968F6E648718051133%''
or tp_ContentTypes like ''%0x010024290FBE2869495eB819832776560730%''
)'


Post to Twitter Post to Delicious Post to Digg Post to Facebook Post to Reddit

SharePoint 2013–Setting Default My Site

28 February, 2014 (07:53) | SharePoint | By: Paul Liebrand

I’ve made a couple posts in the past around how to set your Default My Site with SharePoint 2007 by clicking the “Set as Default My Site” button when visiting your My Site.  This option does not exist in SharePoint 2013 so how do you go about setting your default My Site to take advantage of the Office features that get enabled?

The only way I have found to do this in SharePoint 2013 is to navigate to any document library (including the one on your SkyDrive) and then click the Library tab and then click Connect to SharePoint Sites. If your My Site has not been set as your default, you’ll get the following dialog box:

NewMySite

If you click Yes then you’ll get the following registry key written to your computer:

HKEY_CURRENT_USER\Software\AppDataLow\Microsoft\Office\15.0\Common\Portal

And you’ll see a string value called PersonalSiteUrl and the value will be the URL to your My Site.

NOTE: If you delete the LinkPublishingTimestamp entry from this registry location and start an Office product such as Word or Excel, within a few minutes it will require the list and hydrate the SharePoint Sites location on your computer.

If you are switching to another version of SharePoint or the URL for your My Site has changed, you may see the following dialog:

OldToNew

From here on, your Office client will query the following address to get a list of sites you are a member of or that you have connected using that button:

http://mysiteurl/_vti_bin/publishedlinksservice.asmx

A few years ago I made a utility to allow you to query this service and see the results of the items that should get pushed to your desktop via Office. The utility still works against SharePoint 2013 and to download it and get more information visit this post: http://www.paulliebrand.com/2009/08/25/publishing-links-to-office-2007-without-enabling-my-sites-in-sharepoint/


Post to Twitter Post to Delicious Post to Digg Post to Facebook Post to Reddit

SharePoint 2013 – Get the most out of SharePoint dialog explained

26 February, 2014 (20:49) | SharePoint | By: Paul Liebrand

The purpose of this post is to hopefully to add some clarity around the “Get the most out of SharePoint” dialog box that appears when visiting your My Site for the first time.

GetTheMostOutOfSharePoint 

What is the purpose of this dialog box?  As shown above, if the user clicks “Ok” it essentially changes the privacy settings around the newsfeed so other people can see it (which of not public by default). If the user clicks “No Thanks” then nothing happens (unchecking the box and clicking Ok effectively does the same thing).

Once the user clicks Ok or No Thanks the My Site Instantiation Timer Jobs take over which run every minutes. The timer jobs finalize the configuration of the My Site and remove the “We’re Almost Ready” message. By default, the timer jobs run every minute.

AlmostReady

You can tell the timer job has completed successfully when the “We’re almost ready!” message disappears and is replaced with the micro blogging feed.

MicroBlogging

You’ll also notice some additional links appear on the left side (blogs, apps, etc). When clicking on your SkyDrive link at the top you should be presented with your Documents library.

Let’s discuss an additional scenario you might be faced with. Let’s say you are upgrading from a previous version of SharePoint to SharePoint 2013 and your users already have My Sites. The “Get the most out of SharePoint” dialog box will look slight different and this next part is extremely important.

GetTheMostOutOfSharePointMySite

Upgraded from previous version of SharePoint?

If SharePoint detects the user has an existing My Site you will have an additional option that states “One library is all you need!”  If you read the description it states “Move your existing My Site documents to your SkyDrive Pro, the place to store, sync, and share your work.”.

What does this option mean? 

If the user clicks Ok at this point then SharePoint will essentially move all of your document libraries from your previous My Site into folders under your SharePoint 2013 documents location (the SkyDrive link at the top). I personally like this experience in SharePoint 2013 but if you want to leave everything as individual document libraries (aka apps) then be sure to uncheck this option.

Once again – since the instantiation is happening within a timer job the “conversion” could take a few minutes. You’ll get a message like this:

GettingReady

As the message states, you can navigate away because it is all being converted in the background. At some point you’ll notice all your content has been moved to your SkyDrive section.

What happens if I clicked “No Thanks” but I have changed my mind and decided I want to switch to One library?

There is no button or option I could find on the My Site to trigger this dialog box again. However, I discovered a few ways to make it come up again.

Option 1

– Navigate to your My Site (Newsfeed, SkyDrive or Sites)

– In the address bar, put the following: (NOTE: If you are not upgrading from a previous My Site, omit the &HasMySite=1 option)

javascript:SP.SOD.loadMultiple([‘SP.UI.Dialog.js’, ‘core.js’], function() {{SP.UI.ModalDialog.showPlatformFirstRunDialog(‘http://mysiteurl/_layouts/15/InitialSetup.aspx?HasMySite=1’, RefreshOnDialogClose);}})

WARNING: If you cut and paste this into your address bar, IE may remove the javascript piece so just manually add it back in.

Upon hitting enter, the dialog box will appear and you can click “Ok” and the instantiation of your My Site will begin.

Option 2

In the User Profile Service Application via Central Admin, add the First Run Experience user property and then navigate to the users My Site and change the following options:

Personal Site Capabilities <blank>
First Run Experience 14
Personal Site Instantiation State <blank>

Once you have saved these settings for that user, when they navigate to their My Site they will get the dialog box again.

Option 3

Alternatively, you can simply navigate to your My Site and then go to the following URL:

http://mysiteurl/_layouts/15/InitialSetup.aspx?HasMySite=1

This option will function correctly but it will not close or redirect so it is not as elegant.

If I previously checked the box “Let’s get social” and I’ve changed my mind will the above process work if I bring the dialog box up again and then uncheck it before clicking “Ok” or “No Thanks”?

No. There is no code to revert the privacy settings on this dialog box. You should only use these methods if the user click No Thanks or unchecked either one of the boxes and have changed their minds and primarily if you you want to consolidate down to one library from a previous My Site.

With that being said, you can simply run the ShareAllSocialData($false) in PowerShell against the specific user profile.

For example:

$site = Get-SPSite "http://mysiteurl"
$context = Get-SPServiceContext $site
$pm = New-Object Microsoft.Office.Server.UserProfiles.UserProfileManager($context)
$profile = $pm.GetUserProfile("domain\account")
$profile.ShareAllSocialData($false)
$profile.Commit()

 

You can also check or uncheck the following User Profile properties which effectively do the same thing:

People I Follow

Activities I want to share in my newsfeed

An end user can change their privacy settings directly on their My Site by doing the following:

  • Click the drop down on your name and then click About Me
  • Click edit your profile
  • Click the … button and then select Newsfeed Settings

EditDetails

  • Check/Uncheck the People I Follow and Activities I want to share in my newsfeed

What if you want disable the First Run Experience altogether?

There is already a post out on the Internet that explains how to do this via SharePoint Designer (see http://www.ilovesharepoint.com/2013/03/get-rid-of-mysite-lets-get-social-dialog.html) but there is another way of doing it via a registry setting on the SharePoint servers.

Add the following key on the SharePoint WFE’s and it will effectively disable the first run experience:

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Shared Tools\Web Server Extensions\15.0\NoFirstRun

Hopefully you find this information useful.


Post to Twitter Post to Delicious Post to Digg Post to Facebook Post to Reddit

SharePoint 2013 Edit vs. Contribute – What the hell happened?

20 February, 2014 (21:38) | SharePoint | By: Paul Liebrand

Today I discovered an interesting change to the security model in SharePoint 2013. Create a new team site with the three (3) default groups: Visitor, Members, and Owners.  Without observing this too closely I noticed that people I added to the Members group were able to completely change all the pages and delete lists.

I thought to myself, “wait a minute – contributors should not have this level of access. All they should be able to do is add, update, or delete content on existing lists.”  I check the permission levels for Contribute and saw it was setup how I expected. Baffled.

After some further analysis, I determined that in SharePoint 2013 there is new permission level called Edit and it is assigned to the member group by default. The Edit permission level states:

Can add, edit and delete lists; can view, add, update and delete list items and documents.

This seems extremely strange and I just do not feel this should be the default setting for a member group. I have no discovered the reason why Microsoft has made this change yet or what benefit it is serving.

I decided to take a look at what the code is doing so I can figure out if there is a way around it. I discovered the following check in the PermissionSetupPage code within Microsoft.SharePoint.ApplicationPages.dll.

sPGroup = this.OwnerParam.Create(currentUser, nums, nums1, PermissionSetupPage.GroupType.Owner);
sPGroup1 = this.MemberParam.Create(sPGroup, nums, nums1, PermissionSetupPage.GroupType.Member);
sPGroup2 = this.VisitorParam.Create(sPGroup, nums, nums1, PermissionSetupPage.GroupType.Visitor);
SPRoleType sPRoleType = (SPUtilityInternal.ShouldUseEditRole(base.Web) ? SPRoleType.Editor : SPRoleType.Contributor);
if (this.CanGrantPermission)
{
this.GrantPermission(sPGroup, SPRoleType.Administrator);
this.GrantPermission(sPGroup2, SPRoleType.Reader);
this.GrantPermission(sPGroup1, sPRoleType);
}

 

Take note of the SPUtilityInternal.ShouldUseEditRole method that is being called. I followed the trail to this method and found the following code:

internal static bool ShouldUseEditRole(SPWeb web)
{
if (web.RoleDefinitions.GetByTypeNoThrow(SPRoleType.Editor) == null)
{
return false;
}
return web.UseEditRole;
}

 

So it is simply checking for the existence of the Edit permission level in the web and if it doesn’t exist it returns a false and then the calling code will use Contribute instead.

Solution

So if you want to force your SharePoint 2013 environment to use the old method, simply do the following steps:

  1. Change all the Members groups from Edit to Contribute.
  2. Delete the Edit Permission level

Moving forward – all new sites will now use Contribute instead of Edit. I may consider writing a custom solution in the near future to allow SharePoint Administrators to simply install and change the default behavior but I need to make sure I understand why Microsoft made this drastic change.


Post to Twitter Post to Delicious Post to Digg Post to Facebook Post to Reddit

SharePoint 2013 Cumulative Updates Mismatch

23 January, 2014 (15:16) | SharePoint | By: Paul Liebrand

We ran into an issue this week in which the SharePoint 2013 Cumulative Updates installed on the servers did not match what the SharePoint farm thought it was. We had the March 2013 Cumulative Update installed and we were attempting to install a December Hotfix. When running the executable for the hotfix, we received the error message: “The expected version of the production was not found on the system”. The only requirement for this hotfix was that the March 2013 CU was installed.

Both the patch status screen within SharePoint and the Installed Updates within Windows showed the March 2013 CU was installed and nothing we seemed to do could get us going again.

We have no idea how it got in this state… we don’t know if the wizard didn’t get run at some point or what and a call to Microsoft came up empty too and they were stating that we may have to rebuild the whole environment from scratch.

I decided to try a few things before throwing in the towel. The following is a list of the things I did that eventually got the environment to a nice stable and healthy place.

  1. Detach All Content Databases (this step is optional)
  2. Clear the SharePoint Configuration Cache (I recommend using http://spcachecleaner.codeplex.com/)
  3. On the server hosting Central Admin, execute and wait for it to finish to 100%:

    psconfig –cmd upgrade –inplace b2b –wait –force

  4. Execute the above command on the remaining servers in the farm one at a time.
  5. Install the cumulative update (or hotfix) on each server and reboot if requested.
  6. On the server hosting Central Admin, run the SharePoint 2013 Product and Configuration Wizard and wait for it to finish 100%.
  7. On the remaining servers in the farm, run the wizard and complete the upgrade.
  8. Repeat steps 5-7 for any remaining updates.

At this point, everything should be installed correctly and your updates should now match what is installed.


Post to Twitter Post to Delicious Post to Digg Post to Facebook Post to Reddit