Facebook Page

Posted by Troy on August 7, 2010 under Blogging, Business, Business Intelligence, IT, Microsoft, Performance Management, Social Networking | Be the First to Comment

Well I am not sure how much sense it makes for a Blog to have a Facebook Page but I though I would try it out.  I am always looking for new topics or issues to write about especially in the area of Business Intelligence or even day to day question on how to use Microsoft Office and SharePoint to enhance business activities.  Feel free to post ideas or comments. 

 

Troy Scott – Blog

Promote Your Page Too

Cannot start service SPUserCodeV4 on computer

Posted by Troy on August 6, 2010 under .net, IT, Microsoft, SharePoint, Visual Studio, Web | Be the First to Comment

This week I was creating my first SharePoint 2010 Sandboxed solution using Visual Studio 2010.  I have successfully built and deployed other SharePoint projects on the server but I always used Farm based solution due to the requirements.

When I built the Sandboxed solution the project would build and package without any errors but when I tried to deploy it to the SharePoint site the following error occurred:

Error    1    Error occurred in deployment step ‘Activate Features’: Cannot start service SPUserCodeV4 on computer ‘SERVERNAME’ 0    0    SP2010Dev1

The error can be easily resolved by starting the Microsoft SharePoint Foundation Sandboxed Code Service which can be accessed through the Central Administration site in SharePoint.   Open the Central Administration site and go to System Settings and click on Manage Service on server:

image

Check to see if Microsoft SharePoint Foundation Sandboxed Code Service  is running, it should be stopped :

image

Start the service and try deploying the Sandboxed solution.

Thanks to Sergey Hyper Kravchenko for his post on the MSDN SharePoint discussion forum:

error occurred in deployment step ‘retract solution’ cannot start service SPUserCodeV4 on this computer

Troy

Running Visual Studio 2010 as Administrator

Posted by Troy on August 5, 2010 under .net, IT, Microsoft, Visual Studio | Be the First to Comment

If you are using Windows 7 or Windows Server 2008 and you try to create a project once Visual Studio has been opened you may receive the following message:

This task requires the application to have elevated permissions

image

If this occurs you have two options:

Right-click on the Visual Studio 2010 Shortcut

Hold down the SHIFT key and right click the shortcut:

image

Select Run as administrator and when you try to create project it will work.   The downside of this approach is that you have to do this every time you want to run Visual Studio.

Set the Visual Studio Shortcut Properties to Run As Administrator

Hold down the SHIFT key and right click the shortcut:

image 

Select properties and then click on the  Compatibility tab.  In the Privilege level section select the Run this program as an administrator check box.

image 

Click Apply and when you double click the shortcut next time the program will run with Administrative privileges.   However, you will receive a User Account Control notification when the program is run:

image

Troy

Creating an Update Operation for an External Content Type

Posted by Troy on July 17, 2010 under Business, Business Intelligence, IT, Microsoft, Performance Management, SQL Server, SharePoint | 3 Comments to Read

* Please note that the following post is based on SharePoint 2010 Foundation Server and not SharePoint 2010 Server. 

In a previous post , I created an External Content Type with 2 operations and then created an External List based on the External Content Type.  In short this means that you are now able to create a SharePoint List based on some external data (e.g. database table or store procedure in this example).   But currently the external data is read only because we only created the following operations for the External Content Type:

  • Read List
  • Read Item

Given that the example was based on Sales Forecast data at the very least we need to give the user the ability to update the data.  In order to do this a new operation needs to be added and a new stored procedure is required to support the operation.  Before we add the  the Update Operation to the BcsSalesForecast External Content Type we need to create a store procedure which will be used for this operation called dbo.BcsSalesForecastUpdate:

CREATE procedure [dbo].[BcsSalesForecastUpdate] @ID nvarchar(512), @ForecastAmount int as set nocount on update dbo.WeeklySalesForecast set ForecastAmount = @ForecastAmount from dbo.WeeklySalesForecast where EnglishMonthName + '-' + WeekNumber + '-' + SalesTerritoryRegion + '-' + Category = @ID

Now that the store procedure is created, SharePoint Designer can be used to add the new operation to the BcsSalesForecast External Content Type.  Navigate to the BcsSalesForecast External Content Type and click “Edit External Content Type” on the Ribbon:

image

Now click on the “Operations Design View” Menu item on the Ribbon:

image

Right-click on the Routine folder and select Refresh.   The dbo.BcsSalesForecastUpdate stored procedure should appear.  Right-click on the stored procedure and select “New Update Operation”. 

image

Make sure the @ID is select as the “Map to Identifier”:

select * from dbo.WeeklySalesForecast where ForecastAmount is not null

image

The BcsSalesForecastReadItem and the BcsSalesForecastReadList have to be updated too.  The following fields must be set to “Read Only” or the new Edit Form will not work:

  • MonthName
  • WeekNumber
  • SalesGroup
  • SalesRegion
  • ProductCategory
  • LastYearAmount

Below is an example of setting a field to read only.  Remember this must be performed on both the Read Item and Read List operations:

image 

Click Finish and the new operation has been created.  The solution is not finished yet.  Remember, we also have an External List called “Sales Forecast”.  If you view the Sales Forecast list and right-click on a row you will notice that there is a new menu item called “Edit Item” and the “Edit Item” button in the ribbon is no longer grayed out.   Try to edit the row.  You should receive the following error:

image

The reason for this is that an Edit Form does not exist for the list.  To work around this we can simply create a new External List and call it “Sales Forecast 2010” and the SharePoint designer will create the necessary forms depending on what operations have been defined for the External Content Type:

image

Select the list in SharePoint Designer and click the “Preview in Browser” button on the Ribbon to try out the new “Edit” functionality.  Right-click on any row on the list and select Edit item.  The following form will pop-up:

image

Click Save and the the SharePoint List and the External Data will be updated.   Use Management Studio and execute the following query against the dbo.WeeklySalesForecast:

select * from dbo.WeeklySalesForecast where ForecastAmount is not null

Now this example may not be practical especially if one person was responsible for updating all of the forecast data.  But this example shows how easy it is to create a simple CRUD (Create, Read, Update, Delete) based application based on External data with little or no code.   This example only implemented the Read and Update operations but the Create and Delete operations would be very easy to implement and would require 2 more stored procedures (dbo.BcsSalesForecastCreate, dbo.BcsSalesForecastDelete)

Troy

Setting Permissions for an External Content Type

Posted by Troy on July 9, 2010 under Business Intelligence, IT, Microsoft, SQL Server, SharePoint | Be the First to Comment

In a previous post, I created an External Content Type based on the following Stored Procedures:

  • dbo.BcsSalesForecastReadList
  • dbo.BcsSalesForecastReadItem

Before you can use the External Content Type the permissions must be set.   The permissions are set using the SharePoint 2010 Central Administration Panel.  Open the Central Administration Panel and you should see the following:

image

Under the Application Management Section click on the Manage Service Application settings link.  Next Click on the Business Connectivity Data Service and you should see the External Content Type called BcsSalesForecast:

image

Hover over the BcsSalesForecast External Content Type and select “Set Permissions” from the drop down box:

image 

Type in the username (Domain\userid) and click check names to verify the user and then click Add.  Once the user or users are added you can set the permissions.  When I was adding my user id I found that I had to be connected to my domain in order to add my account.  For example, if you are using laptop at home and you are not connected to your companies domain you probably won’t be able to add the account to the External Content Type.  If you have VPN Access to you company network then you can connect to the Domain and then try adding the Account.

image

Once the permissions have been set you can now create an External List based on the External Content Type using the SharePoint Designer.  Just Navigate to the External Content Type in the SharePoint Designer and Select BcsSalesForecast and then click External List located in the Ribbon as shown below:

image

This will create an External List called Sales Forecast. Because only ReadList and ReadItem operations are defined for the External Content Type, for now, you can only view all the items in for the Forecast or view the details of one item.

image

If you have not set the permission for the External Content Type you will receive the following error when you try to access the External List:

Access denied by Business Data Connectivity.

Troy