Problem: I am inserting new items into a list using Linq-to-sharepoint (SPMetal), my code throws a ThreadAbortException exception.
Initial Hypothesis: When I run the code as a Site Collection Owner the new list item is inserted. So this is a permissions issues. I increase the permissions on the user that can't insert the list item. It works so this is clearly a permissions issue. After the user tries to perform the insert list item, they are directed to the "Error: Access Denied" message on the web page. Clearly the error message is misleading however, SharePoint seems to understand the ThreadAbortException is a permissions issue. The issue is the user does not have sufficient permissions to perform the action. By elevating the user permissions the error goes away. All well except the error logging is throwing an odd error, after some digging this issue has been blogged before however not for LINQ to SharePoint.
Resolution: Assign the correct permissions to the user performing an action.
Friday, 20 August 2010
SPMetal is throwing a ThreadAbortException
Labels:
error,
error trapping,
LINQ,
SP2010,
SPMetal,
ThreadAbortException
Thursday, 19 August 2010
SPMetal Invalid file name error
Problem: SPMetal fails with the following error:
Error: Invalid file name.
The file name you specified could not be used. It may be the name of an existing file or directory, or you may not have permission to access the file.
Initial Hypothesis: Permissions on the directory are wrong or the SPMetal proxy code file being created is locked. Folder permissions haven't change and the file is removed from previous runs. So my initial hypothesis is wrong. Previously I was working on building lists created from custom content types and deployed via a feature. There are 2 lists based on content types. The list definition, custom content type & site columns have been removed. The 2 lists still appear in my UI and when I click on the list I get an application NullReferenceException error. Makes sense as SharePoint hasn't cleared up the list instances.
============
Updated Problem: I have 2 lists on my SharePoint 2010 site that I can see in the web UI and through my Visual Studio Server Explorer however, I can't get into the UI as I am getting the NullReferenceException error. I need to remove the lists to allow SPMetal to work.
Initial Hypothesis: Use another tool to delete the list, VS solution explorer won't let me update the list. Use SharePoint Designer, on opening SPD it won't show me any lists or libraries. So I'm left with using an stsadm cmd or Power Shell. As I am loving PowerGui I went for the Power Shell Solution.
Resolution: Open the SharePoint Power Shell window, delete the lists using the following code:
$url = "http://demo1"
$site=new-object Microsoft.SharePoint.SPSite($url)
$web = $site.OpenWeb()
$list = $web.Lists["Customers"]
$list.Delete()
Now SPD works, SPMetal works - Problem resolved.
Summary: I created lists from content types, I removed the content types, list definitions however I left the list instance. This cause SPD, SPMetal to err. Cleaning the defunct lists using Power Shell corrects the issues.
More Info:
PowerGui sharePoint CheatSheet
Error: Invalid file name.
The file name you specified could not be used. It may be the name of an existing file or directory, or you may not have permission to access the file.
Initial Hypothesis: Permissions on the directory are wrong or the SPMetal proxy code file being created is locked. Folder permissions haven't change and the file is removed from previous runs. So my initial hypothesis is wrong. Previously I was working on building lists created from custom content types and deployed via a feature. There are 2 lists based on content types. The list definition, custom content type & site columns have been removed. The 2 lists still appear in my UI and when I click on the list I get an application NullReferenceException error. Makes sense as SharePoint hasn't cleared up the list instances.
============
Updated Problem: I have 2 lists on my SharePoint 2010 site that I can see in the web UI and through my Visual Studio Server Explorer however, I can't get into the UI as I am getting the NullReferenceException error. I need to remove the lists to allow SPMetal to work.
Initial Hypothesis: Use another tool to delete the list, VS solution explorer won't let me update the list. Use SharePoint Designer, on opening SPD it won't show me any lists or libraries. So I'm left with using an stsadm cmd or Power Shell. As I am loving PowerGui I went for the Power Shell Solution.
Resolution: Open the SharePoint Power Shell window, delete the lists using the following code:
$url = "http://demo1"
$site=new-object Microsoft.SharePoint.SPSite($url)
$web = $site.OpenWeb()
$list = $web.Lists["Customers"]
$list.Delete()
Now SPD works, SPMetal works - Problem resolved.
Summary: I created lists from content types, I removed the content types, list definitions however I left the list instance. This cause SPD, SPMetal to err. Cleaning the defunct lists using Power Shell corrects the issues.
More Info:
PowerGui sharePoint CheatSheet
Monday, 16 August 2010
Using PowerShell to retrieve SharePoint site column guids
Problem: I am creating a Content Type that uses 1 of the built in site columns (field column), I need the guid of a OOTB site column. I am looking to use the OOTB "Append-Only Comments" site column.
Resolution: Open PowerShell and execute the cmd:
$web = Get-SPweb http://demo1
write-host $web.Fields["Append-Only Comments"].Id
Resolution: Open PowerShell and execute the cmd:
$web = Get-SPweb http://demo1
write-host $web.Fields["Append-Only Comments"].Id
Tip: Don't add xml comments into declaritive content type creation, it stops the activation without any warning.
Labels:
Content types,
Powershell,
SharePoint 2010,
site columns
SharePoint 2010 Error occurred in deployment of step ‘Activate Features’: the field with ID defined in feature was found in the current site collection or in a sub site.
Problem: I can't redeploy Site columns using Visual studio 2010 to an SP2010 site collection. I get the error "Error occurred in deployment of step ‘Activate Features’: the field with ID defined in feature was found in the current site collection or in a sub site".
Resolution: Retract wsp, restart VS2010, open the project and deploy the solution. VS2010 is caching data.
Microsoft kb
Resolution: Retract wsp, restart VS2010, open the project and deploy the solution. VS2010 is caching data.
Microsoft kb
Friday, 13 August 2010
SharePoint 2010 Software Licencing
Rough idea of pricing excluding VAT. This is not from Microsoft and pricing is not fixed as I have laid it out in this post. Saying that, please consult a licencing expert most resellers such as HP have licencing experts to help you, this is merely a guide to help you get started. Without further procrastination ...
Windows 2008 & SharePoint is priced on a per server basis. SQL is charged at a per processor licence. Software assurance is about and additional 28-30/year.
Tip: Licencing prices change depending on factors such as volume discounts, types of licences, software assurance, are you a charity, are you buying or renting licences. This post takes a simplistic view of SharePoint licencing and is not Microsoft's policy but merely to help mine the licencing minefield that faces most big software projects. Please consult a licencing expert, it will save you time and money.
Tip: Windows External Connector licences for Windows 2008 (Needed for SharePoint 2010 Internet licences if the external users will use any file or print functionality provided by Windows)
More Info:
Microsoft's SharePoint Licencing
Development Platform Stack (SharePoint versions for developers)
Update: 15 Nov 2010 - Microsoft SharePoint 2010 for Internet explained A good document explaining mix of Internet and Intranet usage
SharePoint 2010 version comparisons
Licencing explained -
Ari's blog - licencing
http://stovereffect.com/2010/07/03/sharepoint-2010-licensing-part-v-sharepoint-2010-licensing-costs/
Lync licencing - Office Communicator 2007 R2 upgrade
Developer & UAT licences would be covered by MSDN/technet subscriptions. Technet does not include Visual Studio 2010.
VS2010 & TFS licencing
========
Example to explain licencing
Scenario:
We have 700 internal users with AD accounts. We have 15 external suppliers with a total of 2000 users that access our SP2010 system. We have a dedicated physical SQL Server 2008 R2 std edition and 2 SharePoint NLB Windows 2008R2 std edition web servers. What licences do we need?
Assumptions:
Prices are my estimated guess.
Software assurance (SA) is not selected, simply multiply by 1.6 for a rough figure.
Resolution:
3 Windows 2008 R2 licences for the SQL box and 2 web servers. +-£7K
SQL Server licences charged at per CPU. 4CPUs for +-£14K
SP2010 Std edition licences for the 700 internal users at £3K/server for 2 servers +- £6K
SP2010 Std edition licences for the external/Internet licence users at £5,5K/server for 2 servers +- £11K
700 Std user SP2010 cal's @£45/user +- £31,5K
Total Software estimate: £69.5K
Note: As you can see you have to pay for 4 server licences on 2 servers. Those astute people out there may realise that you could add 2 more SP 2010 servers to your farm without paying for and more SP licences. Only think is you need to then only allow internal access on the Internal servers and Internet access to the external SP server.
Development Licences
Technet covers all development licences you will need with the exception of Visual Studio. MSDN licencing includes Visual Studio 2010. Visual Studio Ultimate, & Professinal can be purchase individually or through MSDN.
TFS 2010 (Team Foundation Server) has 3 ways to get licences:
Update 8 Mar 2011: Ari Bakker Post of Web Parts by SP licence Type
Update 10 Nov 2011: Technet
More Info:
http://stovereffect.com/2010/07/01/sharepoint-2010-licensing-part-iii-search-office-web-applications-and-project-server/
http://www.directionsonmicrosoft.com/microsoft-licensing/30-licensing/1458-sharepoint-server-2010-licensing.html
Windows 2008 & SharePoint is priced on a per server basis. SQL is charged at a per processor licence. Software assurance is about and additional 28-30/year.
- Windows 2008 R2 standard x64 - £2,5k
- SharePoint Std Internet - 5,5K ?
- SharePoint Ent Internet - 20K ?
- SharePoint Std Internal - 3K ?
- SharePoint Ent Internal - ?
- SharePoint Std CAL £45/cal
- SharePoint Ent CAL £80/cal
- SQL 2008 R2 Std/proc £3,5k
- SQL 2008 R2 Ent/Proc £14k
Tip: Licencing prices change depending on factors such as volume discounts, types of licences, software assurance, are you a charity, are you buying or renting licences. This post takes a simplistic view of SharePoint licencing and is not Microsoft's policy but merely to help mine the licencing minefield that faces most big software projects. Please consult a licencing expert, it will save you time and money.
Tip: Windows External Connector licences for Windows 2008 (Needed for SharePoint 2010 Internet licences if the external users will use any file or print functionality provided by Windows)
More Info:
Microsoft's SharePoint Licencing
Development Platform Stack (SharePoint versions for developers)
Update: 15 Nov 2010 - Microsoft SharePoint 2010 for Internet explained A good document explaining mix of Internet and Intranet usage
SharePoint 2010 version comparisons
Licencing explained -
Ari's blog - licencing
http://stovereffect.com/2010/07/03/sharepoint-2010-licensing-part-v-sharepoint-2010-licensing-costs/
Lync licencing - Office Communicator 2007 R2 upgrade
Developer & UAT licences would be covered by MSDN/technet subscriptions. Technet does not include Visual Studio 2010.
VS2010 & TFS licencing
========
Example to explain licencing
Scenario:
We have 700 internal users with AD accounts. We have 15 external suppliers with a total of 2000 users that access our SP2010 system. We have a dedicated physical SQL Server 2008 R2 std edition and 2 SharePoint NLB Windows 2008R2 std edition web servers. What licences do we need?
Assumptions:
Prices are my estimated guess.
Software assurance (SA) is not selected, simply multiply by 1.6 for a rough figure.
Resolution:
3 Windows 2008 R2 licences for the SQL box and 2 web servers. +-£7K
SQL Server licences charged at per CPU. 4CPUs for +-£14K
SP2010 Std edition licences for the 700 internal users at £3K/server for 2 servers +- £6K
SP2010 Std edition licences for the external/Internet licence users at £5,5K/server for 2 servers +- £11K
700 Std user SP2010 cal's @£45/user +- £31,5K
Total Software estimate: £69.5K
Note: As you can see you have to pay for 4 server licences on 2 servers. Those astute people out there may realise that you could add 2 more SP 2010 servers to your farm without paying for and more SP licences. Only think is you need to then only allow internal access on the Internal servers and Internet access to the external SP server.
Development Licences
Technet covers all development licences you will need with the exception of Visual Studio. MSDN licencing includes Visual Studio 2010. Visual Studio Ultimate, & Professinal can be purchase individually or through MSDN.
TFS 2010 (Team Foundation Server) has 3 ways to get licences:
- MSDN - individual all versions get 1 instance licence & 1 Cal with a MSDN subscription.
- Volume licencing – each person accessing TFS server needs a Cal.
- Retails – Organisation gets 1 instance of TFS & 5 Cal’s. Approx £500.
Update 8 Mar 2011: Ari Bakker Post of Web Parts by SP licence Type
Update 10 Nov 2011: Technet
More Info:
http://stovereffect.com/2010/07/01/sharepoint-2010-licensing-part-iii-search-office-web-applications-and-project-server/
http://www.directionsonmicrosoft.com/microsoft-licensing/30-licensing/1458-sharepoint-server-2010-licensing.html
SharePoint 2010 console application System.IO.FileNotFound error
Problem: Built a local console app to access a SharePoint site, add System.Web & Microsoft.SharePoint references to the console project. Run the code and get a System.IO.FileNotFound error.
Code SPSite site = new SPSite(http://demo1);
Hypothesis: Check url is correct (it was). VS2010 console apps are set to be x86 by default. SharEPoint only works on x64 so Microsoft.SharePoint is x64.
Resolution: Open VS2010, right click the console project. "Properties" > "Build" tab, set "Platform target to "x64".
Tip: Uses the .NET 3.5 for console applications.
More info: Top 2 search on Google yielded the solution. Console FileNotFound error. and 2nd solution System.IO.FileNotFound Error
Code SPSite site = new SPSite(http://demo1);
Hypothesis: Check url is correct (it was). VS2010 console apps are set to be x86 by default. SharEPoint only works on x64 so Microsoft.SharePoint is x64.
Resolution: Open VS2010, right click the console project. "Properties" > "Build" tab, set "Platform target to "x64".
Tip: Uses the .NET 3.5 for console applications.
More info: Top 2 search on Google yielded the solution. Console FileNotFound error. and 2nd solution System.IO.FileNotFound Error
Labels:
console application,
error,
FileNotFound,
SharePoint 2010
Wednesday, 11 August 2010
Feature Receiver for dispaying Publishing Images as html in a document library
Problem: Publishing images can't be created on a document library however, using a site columns you can add Publishing Images & Publishing Html. However the Fields don't display properly unless you create the content type from the site columns and lastly generate the document library from the content type. I already have data so I need the existing columns to display as a custom list publishing image would work.
Resolution: Create a feature receiver to change the column properties pragmatically. There is a catch in that this only applies if you haven't created the document library off the content type which in turn was created off the site columns. Anyway, attached is a feature receiver scoped at web level look at the customised document library and make the publishing field rich text compliant.
Subscribe to:
Posts (Atom)