If you got the following error in an INSERT statment from entity framework to MSSQL 2008: System.Data.SqlClient.SqlException: The conversion of a datetime2 data type to a datetime data type resulted in an out-of-range value.
Solution:
The problem occurrs when you use Entity Framework to INSERT a System.DateTime (a not initialized one like 0001-01-01 00:00:00.0000000) into the SQL2008 DB. Change the datatype in DB to datetime2 and everything will run smoothly.
Another solution is to initialize the datetime field with a value greater than 1/1/1753.
Dienstag, 27. Juli 2010
Montag, 26. Juli 2010
Data Source Conflict
If you are developing BCS solutions in Visual Studio, you might have experienced the following error when you attempt to create or update a new item in an external list:
DataFormWebPartException: Data Source Conflict: Your changes conflict with those made concurrently by another user. Refresh the form and submit your changes again.
Solution: In your Visual Studio 2010 BCS project, find the Create or Update method that's failing. Verify that each of the fields in your input type descriptor have the Creator property (for the Create method) or Updater property (for the Update method) set to True.
Note, this property should not be set to true for the identifier field if the LOB auto generates the value. You also need to delete and re-add the external list before the changes take effect. (Because the object definition of the external content type is saved in the existing list and does not change when you update the BCS model.)
DataFormWebPartException: Data Source Conflict: Your changes conflict with those made concurrently by another user. Refresh the form and submit your changes again.
Solution: In your Visual Studio 2010 BCS project, find the Create or Update method that's failing. Verify that each of the fields in your input type descriptor have the Creator property (for the Create method) or Updater property (for the Update method) set to True.
Note, this property should not be set to true for the identifier field if the LOB auto generates the value. You also need to delete and re-add the external list before the changes take effect. (Because the object definition of the external content type is saved in the existing list and does not change when you update the BCS model.)
Montag, 19. Juli 2010
There are no addresses available for this application
After creating a Business Data Connectivity Service Application in SharePoint 2010 I wasn’t able to access the service application with the BDC models, external systems and external content types.
I tried to deploy a Visual Studio Solution by hitting F5. The error message I received was: "Error occurred in deployment step 'Add Solution': There are no addresses available for this application.” Clicking the BCS under "Manage service applications" got the same error.
Solution:
Check that the service under "Manage services on server" is running. If the error occures despite the service is running, restart the IIS with "iisreset".
I tried to deploy a Visual Studio Solution by hitting F5. The error message I received was: "Error occurred in deployment step 'Add Solution': There are no addresses available for this application.” Clicking the BCS under "Manage service applications" got the same error.
Solution:
Check that the service under "Manage services on server" is running. If the error occures despite the service is running, restart the IIS with "iisreset".
Labels:
BCS,
Business Connectivity Services,
SharePoint 2010
Debugging SharePoint Solutions
You are using Visual Studio 2010 on a SharePoint 2010 site and get an error when hitting F5 to begin debugging....
The debugger may fail to start and complain that the web.config could not be loaded with the error message: “Could not load the Web.config configuration file. Check the file for any malformed XML elements, and try again. The following error occurred: The given key was not present in the dictionary.”
Make sure the URL assigned to the Default zone for the Web Application’s Alternate Access Mappings matches the Site URL of the SharePoint project in Visual Studio. Using one of the other zones (like Intranet) for the URL will not work. The Default Zone and the project’s Site URL need to match.
The debugger may fail to start and complain that the web.config could not be loaded with the error message: “Could not load the Web.config configuration file. Check the file for any malformed XML elements, and try again. The following error occurred: The given key was not present in the dictionary.”
Make sure the URL assigned to the Default zone for the Web Application’s Alternate Access Mappings matches the Site URL of the SharePoint project in Visual Studio. Using one of the other zones (like Intranet) for the URL will not work. The Default Zone and the project’s Site URL need to match.
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.
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.
Labels:
SharePoint Server 2010,
SPMetal
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.
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.
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.
Montag, 15. März 2010
Access Denied when using EnsureUser
Sometimes you may need to call spweb.EnsureUser from your custom SharePoint web application. This method edits the user permissions on the site and needs some high level permissions like the site collection admin has.
If the user is a "Contributor" or "Reader", he will get the standard sharepoint "Error: Access Denied" message. Your EnsureUser API call has to be wrapped within RunWithElevatedPrivileges. But if you use instances of SPSite or SPWeb, obtained prior to the RunWithElevatedPrivileges block, it won't work as expected because they are already associated to a non-elevated security context.
In the RunWithElevatedPrivileges code block you have to create a new SPSite object simply with the GUID that you get from the previously obtained site.ID.
If the user is a "Contributor" or "Reader", he will get the standard sharepoint "Error: Access Denied" message. Your EnsureUser API call has to be wrapped within RunWithElevatedPrivileges. But if you use instances of SPSite or SPWeb, obtained prior to the RunWithElevatedPrivileges block, it won't work as expected because they are already associated to a non-elevated security context.
In the RunWithElevatedPrivileges code block you have to create a new SPSite object simply with the GUID that you get from the previously obtained site.ID.
Labels:
Access Denied,
EnsureUser,
MOSS 2007,
Sharepoint,
WSS
Abonnieren
Posts (Atom)