Posts mit dem Label SharePoint Server 2010 werden angezeigt. Alle Posts anzeigen
Posts mit dem Label SharePoint Server 2010 werden angezeigt. Alle Posts anzeigen

Donnerstag, 3. Juli 2014

SharePoint ThreadAbortException

Problem: If you are doing a SPSite.OpenWeb() (or maybe its done for you, when you request the profile service) and you do not have the permissions to the site there is an UnauthorizedAccessException being thrown. But if you are trying to catch it, immediately after the catch an ThreadAboardException is thrown and you code does not continue. That is because of access denied exceptions inside page requests are explicitly handled by the platform. For example, when Forms-based authentication is used, anonymous users are redirected to the login page. If the user is already authenticated, he may be redirected to an error message page such as _layouts/AccessDenied.aspx.
When you are developing web parts that behavior is okay but running such code in a timer job or WCF webservice is problematic.

Solution: You should turn off that behaviour by setting the following flag:

bool originalCatchValue = SPSecurity.CatchAccessDeniedException;
SPSecurity.CatchAccessDeniedException = false;

try
{
   // your code

}
finally
{
   SPSecurity.CatchAccessDeniedException = originalCatchValue;
}


Within the try statement you are able to catch the UnauthorizedAccessException as usual.


2nd Problem: Another reason you get a ThreadAbortException could be that your request could not be validated by SharePoint. This could be the case if you are developing a WCF webservice within SharePoint context. In the exception stacktrace you should see  Microsoft.SharePoint.SPWeb.ValidateFormDigest()

Solution:
In this case SPContext.Current is not null, Sharepoint tries to verify requests using security validation digest provided by FormDigest Class. According to msdn:
"To make posts from a Web application that modify the contents of the database, you must include the FormDigest control in the form making the post. The FormDigest control generates a security validation, or message digest, to help prevent the type of attack whereby a user is tricked into posting data to the server without knowing it. The security validation is specific to a user, site, and time period and expires after a configurable amount of time. When the user requests a page, the server returns the page with security validation inserted. When the user then submits the form, the server verifies that the security validation has not changed".
In WCF service you don't have security digest. To avoid this check try to set HttpContext.Current to null temporary when you call siteCollection.Add() method:

var ctx = HttpContext.Current;
try
{
    HttpContext.Current = null;
    // your code
}
finally
{
    HttpContext.Current = ctx;
}

Dienstag, 13. April 2010

FileNotFoundException when using SPMetal

If you are working with SharePoint 2010 and using SPMetal to access list data in your site, you might encounter the error:

System.IO.FileNotFoundException: The Web application at [SITE] could not be found. Verify that you have typed the URL correctly
I created a code library project to include the SPMetal output file and do some business logic when accessing the SharePoint list data.

I want to test that code from Visual Studio, so I created a test project. Unfortunately the test projects run with the .net Framework 4 and you are not able to change that in the project properties.

So I used a console application with .net Framework 3.5 and I had to change the Target CPU to x64 (or you can use AnyCPU) because SharePoint is build only for 64 bit platforms.

Freitag, 9. April 2010

BCS: Association Error

You are developing an association between BCS entities. You encouner an error like:
Exception handed to HandleRuntimeException.HandleException System.InvalidOperationException: The Association with Name 'SomethingAssociationNavigator' expects '1' EntityInstances (External Items) as input, but '0' were supplied.
Maybe you have defined the finder method of the entity but you missed the specific finder method or you defined a specific finder method but it has a faulty parameter definition.

Mittwoch, 24. März 2010

BCS - add item form for creator method not working

You have created a BCS model, added a creator method to it but it is throwing an Runtime Error. In the logfile you find "SPException: Unable to find the default new form for list"



A probable reason for that error is the following. You created the model only with a ReadList and ReadItem method. Then you created a list in SharePoint and tested that functionality. Then you added a creator method and used the previous created list to add an item. That does not work because the list was provisioned without the "new form". Just delete the list and create a new one. The "new form" for the list should show up as expected.

Dienstag, 23. März 2010

Access denied. You do not have permission to access this content

You have created an External Content Type in SharePoint Designer 2010 with the authentication mode "User's Identity". When you create a list and want to access the data in your portal, you get the error message "Access denied. You do not have permission to access this content" or "Access denied by Business Data Connectivity".

You need to set permissions in Central Administration under "Manage Service Applications" in the "Business Data Connectivity Service Application". Click the BCS service and configure the permissions in the context menu of your ETC.

Also the user needs permissions in your external database.

Dienstag, 20. Oktober 2009

Microsoft Unveils SharePoint Server 2010

Today, at Microsoft Corp.’s SharePoint Conference in Las Vegas, Microsoft Chief Executive Officer Steve Ballmer announced that the public beta of Microsoft SharePoint Server 2010 and Microsoft Office 2010 will become available in November, and revealed some of the new SharePoint Server 2010 capabilities for the first time.

During his keynote address, Ballmer talked broadly about SharePoint Server as a business collaboration platform and highlighted three key areas. One was how organizations can respond quickly to business needs with an improved developer platform that makes it easier to build rich content and collaboration applications. Another topic was the enhanced Internet site capabilities that help businesses drive revenue and retain customers on a single platform. The third was the choice and flexibility between on-premises and cloud solutions. At the event, Microsoft showcased the breadth of SharePoint Server 2010 that ranges from wikis to workflows, while Ballmer’s keynote address highlighted features and capabilities such as these:

  • A new ribbon user interface that makes end users more productive and customization of SharePoint sites easy
  • Deep Office integration through social tagging, backstage integration and document life-cycle management
  • Built-in support for rich media such as video, audio and Silverlight, making it easy to build dynamic Web sites
  • New Web content management features with built-in accessibility through Web Content Accessibility Guidelines 2.0, multilingual support and one-click page layout, enabling anyone to access SharePoint Server sites
  • New SharePoint tools in Microsoft Visual Studio 2010, giving developers a premier experience with the tools they know and trust
  • Business Connectivity Services, which allow developers to connect capabilities to line-of-business data or Web services in SharePoint Server and the Office client
  • Rich APIs and support for Silverlight, representational state transfer (REST) and Language-Integrated Query (LINQ), to help developers rapidly build applications on the SharePoint platform
  • Enterprise features in SharePoint Online such as Excel Services and InfoPath Forms Services, which make it simple to use, share, secure and manage interactive forms across an organization
  • The addition of two new SharePoint SKUs for Internet-facing sites, including an on-premises and hosted offer

The public betas of Microsoft SharePoint Server 2010, Office 2010, Project 2010 and Visio 2010 will become available in November 2009; more information is available at http://go.microsoft.com/?linkid=9689707.
Microsoft SharePoint Server 2010 will be available in the first half of 2010. More information about Microsoft SharePoint Server 2010 can be found at
http://www.microsoft.com/sharepoint.