SharePoint 2010 complete farm installation without domain account

Usually while SharePoint installation we have to select between Standalone and Farm installation. For Standalone installation we don’t need a domain account. It is automatically configured to use local service accounts. But if we have installed SharePoint with Farm Complete setting and still want to use the local service account during for SharePoint configuration.

In normal scenario, we get the below error message while running SharePoint configuration Wizard first time.

The specified user xxx is a local account. Local accounts should only be used in stand alone mode.

Now comes the tricky part. How to bypass this step. This can be achieved by performing below steps:

1. Run SharePoint PowerShell with administrator privileges

2. Run command: New-SPConfigurationDatabase (Provide all the necessary parameters)

3. Make sure provided service account is member of local Administrator group.

4. Now run the SharePoint configuration wizard again. You won’t be asked to enter the domain account.

Cheers!!!

Advertisements

Amazing Uncommon Facts

Q:> Why Microsoft named ISAPI folder as _vti_bin in SharePoint?
Ans:> Microsoft acquired software company called Vermeer Technologies Incorporated which is founded in 1994 and has only one product Front Page.
The _vti_bin folder was used to store the FrontPage server-side extensions. In SharePoint same is used to store the Web Services.

Q:> Why SP workflow doesn’t start automatically when item is created via object model?

Ans:> Many times we have requirement to create a task via workflow or object model and set the list setting to automatically trigger the workflow when item is created. In some scenarios we notice that item is created successfully but workflow doesn’t start. But if we create item via UI then workflow works perfectly. Here is a small tip to debug this issue.

If item is created via system account workflow will not trigger automatically. Same applies to event handlers.

Working with SharePoint Client Object Model

Till SharePoint 2007 we are familiar with SharePoint server object model which is very powerful and allow us to do everything if we have permission to access server physically. For scenarios where our applications can’t be deployed to SharePoint (SP) server but want to use SharePoint as a data source. We go with SharePoint OOB web services (which are limited in functionality) or end up with creating custom services to meet business requirements. In case of custom services, still we need SharePoint server access to deploy our services. Think about scenarios, where it’s impossible to have server access like SharePoint on cloud server (may be one possible scenario). Providing someone access to SharePoint root server on cloud is very risky. Or think about some other department want to use our SharePoint instance. We are forced not to let them deploy there applications on SharePoint server. What could be the possible solution to this? “SharePoint Client Object Model” is the shining star comes with SharePoint 2010.

SharePoint exposes 3 object models:

  1. Managed
  2. Silverlight
  3. ECMAScript (Standardized scripting language like JavaScript or JScript)

Before we go to what each object model do let’s see how client object model works.

When we make a call to SharePoint via client object model,  each client interact with server using service call means client object model makes call to SharePoint service Client.svc (deployed on SharePoint server and act as an interface between Client object model and SharePoint). I hope we all know where SharePoint services are deployed. If don’t know problem you can find it under ISAPI folder of 14 hive. Below is the architectural diagram explains how client access SP server:

Brief about each client object model:

Managed – used to develop custom .NET applications like service, windows applications (WPF), or console applications.

Silverlight – As name signifies it is used by Silverlight applications.

ECMAScript – These are little different than other client object models. These are used inside applications which are hosted inside SharePoint application itself.  In simple terms, cross side scripting is not allowed via ECMAScripts. These scripts should be used on SharePoint pages to access hosting server resources not others. We can use JavaScript or Jscript to achieve same.

Let’s go further deeper. Now we will create applications using each object model to perform CRUD operation on a list.

CRUD operation on a list using Managed Object Model

Step 1: Create a Console application

  1. Open Visual Studio 2010 (Run as Administrator).
  2. Select Windows Console application template (Check you are using .NET Framework 3.5).
  3. Name the project as you like and click ok button.

Step 2: Add SharePoint Client Object Model references

  1. Copy Microsoft.SharePoint.Client.dll and Microsoft.SharePoint.Client.Runtime.dll from SharePoint server ISAPI folder (inside 14 hive) to your project folder.
  2. Right click on project and select Add Reference.
  3. On Add Reference window, select Browse tab and navigate to location where you have copied DLL files. Add both files to project.

Step 3: Write necessary code to do CRUD operation

Copy paste code from attached file to Program.cs file and run your project. (Don’t forget to replace siteURL variable with your server name).

Program

This is just a simple example to start with. We can do lot more with Managed client object model.

CRUD operation on a list using Silverlight Object Model

Silverlight Object Model is slightly different in a way we make call to SharePoint from managed object model. Most of the calls made via Silverlight object model are asynchronous; these calls should not update the current running UI thread. If try to do we will get exception.

Another thing before start is we must place the ClientAccessPolicy.xml file in the SharePoint web application virtual directory. Here is content of xml file:

<?xml version=”1.0″ encoding=”utf-8″ ?>

<access-policy>

<cross-domain-access>

<policy>

<allow-from http-request-headers=”*”>

<domain uri=”*” />

</allow-from>

<grant-to>

<resource path=”/” include-subpaths=”true” />

</grant-to>

</policy>

</cross-domain-access>

</access-policy>

Let’s start with our Silverlight application.

Step 1: Create a Silverlight project

  1. Open Visual Studio 2010 (Run as Administrator).
  2. Select Silverlight application template (Check you are using .NET Framework 3.5).
  3. Name the project as you like and click ok button.

Step 2: Add SharePoint Silverlight Client Object Model references

  1. Copy Microsoft.SharePoint.Client.Silverlight.dll and Microsoft.SharePoint.Client.Silverlight.Runtime.dll from SharePoint server ISAPI folder (inside 14 hive) to your project folder.
  2. Right click on project and select Add Reference.
  3. On Add Reference window, select Browse tab and navigate to location where you have copied DLL files. Add both files to project.

Step 3: Write necessary code to do CRUD operation

MainPage

Copy paste code from attached file to MainPage.xaml.cs file and run your project. (Don’t forget to replace siteURL variable with your server name).

CRUD operation on a list using JavaScript Object Model

JavaScript object model only works if we use inside current server context I mean from WebParts or Application pages etc. JavaScript object model can’t be used to have cross-site access. This behavior makes it different from above object models. We can also use jQuery in place of JavaScript.

Step 1: Create an empty SharePoint project

  1. Open Visual Studio 2010 (Run as Administrator).
  2. Select SharePoint Empty Solution template (Check you are using .NET Framework 3.5).
  3. Name the project as you like and click ok button.

Step 2: Add Application to project

  1. Right click on project and select Add New Item.
  2. Select Application Page and click ok.

Step 3: Write necessary code to do CRUD operation

JavaScriptOM

  1. Copy paste code from attached file to ContentPlaceHolderID=”PlaceHolderMain” In JavaScriptOM.ascx file.
  2. Press F5 to run project. Modify url to view application page like Http://servername/_Layouts/ApplicationFolderName/ApplicationPageName.aspx
  3. Test each CRUD operation

Thant’s all with the SharePoint Client Object Model. More details can be found on Microsoft MSDN. It’s very well documented there.

Links worth looking at:

Client Object Mode

JS Client Object Model and UI Enhancements

List Tools on Ribbon not visible when add more WebParts to List DataSheet view page

I have notice one weird issue when we add more WebParts to SharePoint List DataSheet View page. There are two known issues i found:

1. List View Selector goes off

2. List Tools goes off

Thanks to Alexander Bautz Using his script i am able to solve first issue. But still 2nd issue is present. I don’t know whether Microsoft aware of this issue or not. Not found any details regarding same on MSDN blogs.

Anyway, Below are the steps to reproduce the issue:

1. Create a new view for existing list. Select view type as DataSheet View.

2. If you focus on DataSheet view, you can see both View Selector and List Tools on Ribbon. (see figure 1)

3. Edit DataSheet view page and insert CEWP. Save the page.

4. Now notice both View selector and List Tools gone. In below image View selector is visible because of Alex script. (see figure 2)

Figure 1:

 

Figure 2:

 

Will update this post when i found some solution. If any reader face this same issue and have solution please blog me.

Thanks & Regards,

Rajan

Cannot update TFS workspace

Today i run into a TFS workspace issue. I was getting below error when i open TFS project in Visual Studio 2008:

“TF14091: you cannot perform this operation on workspace. domain/eid are not the owner of the workspace”

Issue cause: VS cache the login credentials for workspace. When we try login with current credentials still it take old credentials from cache.

Solution: Clear the cache and reload it. Follow below steps to do that:

Step 1: Open VS command prompt. (For VS 2008 workspace, open VS 2008 command prompt. If you try to use command prompt, command will not work.)

Step 2: Run below command to clear the local cache.

tf workspaces /remove:*

Step 3: Run below command to set the Owner for respective TFS server

tf workspaces /s:TFS_ServerName

Thats it!!! Now you can open VS and access TFS without any issues.

Bug in Commerce Server Catalog procedure ctlg_GetFTSQuery

I was facing below issue with Commerce Catalog search and while debugging i found that it’s a bug in ctlg_GetFTSQuery procedure. To fix this issue i modifed

IF @IsVirtualCatalog = 1 or  @SQLClause < 1

to

IF @IsVirtualCatalog = 1 or Len( @SQLClause) < 1

    Inner Exception
    ---------------
    Type : System.Data.SqlClient.SqlException, System.Data, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
    Message : Conversion failed when converting the nvarchar value '[DefinitionName] = 'PartNumberProduct' AND ([IsVisible] = 1 )' to data type int.
    Source : .Net SqlClient Data Provider
    Help link : 
    Errors : System.Data.SqlClient.SqlErrorCollection
    Class : 16
    LineNumber : 29
    Number : 245
    Procedure : ctlg_GetFTSQuery
    Server : 
    State : 1

Disable Debug.Assert ui popup message setting

We add debug.assert to our code for debugging purpose. But sometime in a server with many sessions this pop-up message won’t come up and our application processing stuck there waiting for us to click on assert message. On way to find that assert message is login to server as a console. To disable permanently, add following setting to web.config or app.config file of your application to disable debug.assert pop-up message.

<system.diagnostics>
<assert assertuienabled=”false” />
</system.diagnostics>

%d bloggers like this: