It appears in 2010 when you have a boolean in your ContentType definition, the value MUST be in UPPERCASE.
In 2007, it respected any variation of True, true, TRUE etc. In 2010, you get no errors with having booleans in another case, it just does not work.
Wednesday, April 27, 2011
Monday, April 18, 2011
The object specified does not belong to a list
I started getting the "The object specified does not belong to a list" error on a SharePoint site I migrated from 2007 to 2010. The code I "inherited" worked fine in 2007 but raised an error in 2010.
After some investigation, the problem ended up being that an SPFile was constructed in a parent web instead of the web in which the actual file resided using SPWeb.GetFile(url).
So to fix the problem, make sure you construct your SPFile object (using GetFile anyway) in the SPWeb in which the file resides.
eg. if the file lives here: \ParentSite\SubSite\Pages\Page.aspx, make sure the SPWeb you are using is "Subsite".
After some investigation, the problem ended up being that an SPFile was constructed in a parent web instead of the web in which the actual file resided using SPWeb.GetFile(url).
So to fix the problem, make sure you construct your SPFile object (using GetFile anyway) in the SPWeb in which the file resides.
eg. if the file lives here: \ParentSite\SubSite\Pages\Page.aspx, make sure the SPWeb you are using is "Subsite".
Wednesday, March 9, 2011
Setting Version on Masterpage
Pretty simple one here that I had trouble finding anything while googling so I thought I'd add it. If you want to mark a masterpage (or custom action or whatever) as a v4 (SPS 2010) item while provisioning a site, you use the "UIVersion" property.
<File Url="SomeV4.master" Type="GhostableInLibrary"/>
<Property Name="Title" Value="Some Master Page v4" />
<Property Name="MasterPageDescription" Value="SomeMaster Page" />
<Property Name="ContentType" Value="Publishing Master Page" />
<Property Name="UIVersion" Value="4" />
</File>
(sorry about formatting - I don't have my nice VS add-in installed)
<File Url="SomeV4.master" Type="GhostableInLibrary"/>
<Property Name="Title" Value="Some Master Page v4" />
<Property Name="MasterPageDescription" Value="SomeMaster Page" />
<Property Name="ContentType" Value="Publishing Master Page" />
<Property Name="UIVersion" Value="4" />
</File>
(sorry about formatting - I don't have my nice VS add-in installed)
Friday, February 18, 2011
Proxy Settings in Machine.Config
With the our migrations to SharePoint 2010, decided to move our proxy settings to the machine.config files as opposed to web.configs. The infrastucture guys change the URL too often (they alse haven't provided us with a DNS entry) which means we have to edit the config files of multiple web applications and extensions.
Steps required:
1. Add the following to the machine.config:
2. Remove the defaultProxy from section from your web.config files.
PS. The machine.config to edit can be found at: C:\Windows\Microsoft.NET\Framework64\v2.0.50727\CONFIG.
Steps required:
1. Add the following to the machine.config:
<system.net>
<defaultProxy useDefaultCredentials="true">
<proxy usesystemdefault="False" proxyaddress="http://proxy.address" bypassonlocal="True" />
</defaultProxy>
</system.net>
2. Remove the defaultProxy from section from your web.config files.
PS. The machine.config to edit can be found at: C:\Windows\Microsoft.NET\Framework64\v2.0.50727\CONFIG.
Thursday, February 17, 2011
Add New Web Part to Web Part Gallery Broken?
I have a site in SharePoint 2010 running in 2007 mode (don't ask me why? ask the business users). It seems there may be a bug when in the web part gallery that does not allow you to add new web parts (in 2007 mode only). I had a look through the page source and there is definitely some issues with the javascript on the "New" button.
Hopefully, we won't be in 2007 mode for too long, so we are just gonna roll with a workaround. Go to following page and you can add web parts to the web part gallery:
Hopefully, we won't be in 2007 mode for too long, so we are just gonna roll with a workaround. Go to following page and you can add web parts to the web part gallery:
http://{siteurl}/_layouts/NewDwp.aspx
Monday, October 18, 2010
SharePoint 2010 Modifying UI Version in PowerShell
To change UI version of a SharePoint 2010 site between 2007 and 2010 you can use the following PowerShell code:
$site = Get-SPSite -identity http://{site url}
To 2007 mode:
$site | Get-SPWeb -limit all | ForEach-Object { $_.UIversion = 3; $_.UIVersionConfigurationEnabled = $false; $_.update(); }
To 2010 mode:
$site | Get-SPWeb -limit all | ForEach-Object { $_.UIversion = 4; $_.UIVersionConfigurationEnabled = $false; $_.update(); }
$site = Get-SPSite -identity http://{site url}
To 2007 mode:
$site | Get-SPWeb -limit all | ForEach-Object { $_.UIversion = 3; $_.UIVersionConfigurationEnabled = $false; $_.update(); }
To 2010 mode:
$site | Get-SPWeb -limit all | ForEach-Object { $_.UIversion = 4; $_.UIVersionConfigurationEnabled = $false; $_.update(); }
Wednesday, October 6, 2010
PowerShell - Stopping the annoying confirm messages
To stop those annoying confirm messages (i.e. "Are you sure you want to perform this action?") , do this:
$ConfirmPreference = "None"
the end
$ConfirmPreference = "None"
the end
Subscribe to:
Posts (Atom)