Danushka Silva

It's all about SharePoint
The query cannot be completed because the number of lookup columns it contains exceeds the lookup column threshold

Recently I published an InfoPath form and got an error.

“The query cannot be completed because the number of lookup columns it contains exceeds the lookup column threshold enforced by the administrator”

clip_image002

and the event log was like this

Untitled

This is because SharePoint 2010 has a new resource throttling for web applications. It’s an easy fix.

Go to Central Administration site and navigate to Application Management – Manage web applications under Web Applications.

Select the web application you need to change the resource throttling setting.

Navigate to General Settings – Resource Throttling from the top ribbon.

image 

Scroll down a bit and can find the List View Lookup Threshold. Change the value according to your lookup columns.

image

New SharePoint developer tools in Visual Studio 11 Beta

Check the new SharePoint developer tools in Visual Studio 11 developer preview.

http://msdn.microsoft.com/en-us/library/ee290856%28v=VS.110%29.aspx

Microsoft Student Champ's Meeting - December, 2010

The Microsoft Student Champ Community had their last meeting of the year 2010, last Friday (3rd Dec). I was given the great opportunity of hosting a session as the guest speaker. It was a wonderful evening! We had a great crowd, of young university students, there. Here are the slides and SharePoint Foundation links for you to download.

http://cid-18829c69f065aa97.office.live.com/view.aspx/SharePoint%202010/SharePoint%20%202010%20Deployment.pptx

http://www.microsoft.com/downloads/en/details.aspx?FamilyID=49c79a8a-4612-4e7d-a0b4-3bb429b46595&displaylang=en

IMG_4757 IMG_4762 IMG_4758IMG_4760  IMG_4765

BDC model project deployment error – SharePoint 2010

I was trying to develop a BDC model project with visual studio 2010 and tried to change the Identifier. Once I changed the Identifier and tried to deploy. There I got an error.

BDC1

In short, error will be like this

Error    1    Error occurred in deployment step 'Add Solution': Model file 'BdcModel1\BdcModel1.bdcm' has the following External Content Type activation errors:
TypeDescriptor with Name 'Identifier1' (found in Parameter with Name 'returnParameter', Method with Name 'ReadList', Entity (External Content Type) with Name 'Entity1' and Version '1.0.0.4' in Namespace 'BdcModelProject2.BdcModel1') refers to an Identifier with Name 'Identifier1' of Type 'System.Int32' which is supposed to exist on Entity with Name 'Entity1' in Namespace 'BdcModelProject2.BdcModel1'. This Identifier cannot be found.

What you have to do to solve this is very simple.

Go to Central AdministrationApplication ManagementManage Service Applications

There select Business Data Connectivity Services

BDC4

Change the view to External Systems in the View category on the top menu bar.

BDC2

Now you will see your BDC model listed there.

Just click on the model and select Delete from the dropdown menu.

BDC3

In my situation I have already removed the solution from SharePoint (Retracted and Removed). If not please change all 3 views and check for your BDC model and remove it.

How to: Create an External Content type using SharePoint Designer 2010 (Business Connectivity Services)

Here we are going to do a lab that creates an external content type using SharePoint 2010. Assume your company has a database with product details. You need to retrieve those details from the database and show them in the SharePoint site. Here you need to create, update and delete those records within SharePoint environment. So basically we are talking about creating CRUD methods for the external database inside the SharePoint UI.

First I will breakdown entire process into few points where we can very easily follow.

  • Create an External Content Type in SharePoint Designer 2010.
  • Create CRUD methods.
  • Deploy the external content type to SharePoint server.
  • Create an external list
  • Test the lab

OK… will start SharePoint designer and connect to our site. Once you connected to the server you get all the site objects on your left pane. Select External Content Types and you get all the external content types listed on the right pane.

BDCInfo1

Create new external content type by clicking External Content Type button on the top left corner

BDCInfo3

It will open the new external content type screen. Here you can change the key information of your external content type such as Name, Display Name , etc.

BDCInfo41

Now we have to create the data source to connect to our external database. Go to the bottom of the screen and click ‘Click here to discover external data sources and define operations’ link.

BDCInfo42

Now you’re in the screen where you can manage connections to external data sources and operations for the external content type you are going to create.

BDCInfo5

Click Add Connection to add our data source and select SQL Server from the dropdown menu. Press OK button

BDCInfo6

Type your Database Server and Database Name. Select the appropriate security method to connect and press OK.

BDCInfo7

Here you can see your data source has been added to the list.

BDCInfo8

Now we need to add methods to perform our CRUD actions. So will select the Product table which we need to extract data from and right click. Here you can see all the operations you can add to the particular table. Select New Read List Operation from the menu.

BDCInfo9

Now you can see the pop up window where you can configure read list operation. Change the names as you want and click Next.

BDCInfo10

Next you can add filter parameters to filter your data. Otherwise it will make large result with unwanted data. Since our lab database doesn't have much data, we skip that part. Press Next.

BDCInfo11

Here you can see all you columns in the table and select the appropriate columns to show in the external list. You can change their Display Names as well. Make sure to select Map to Identifier check box in the primary key. Click Finish

BDCInfo12

Now you can see the Read List operation in the External Content Type Operations.

BDCInfo13

Create the read item operation the way we did to read list operation.

BDCInfo14 BDCInfo15

 BDCInfo16

Create operation.

BDCInfo17

I have removed Product ID column from create because it’s an auto number field.

BDCInfo18 BDCInfo19

Update operation.

BDCInfo20 BDCInfo21

Delete operation.

BDCInfo22 BDCInfo23

Now we have created all the methods we want and you can see that in the External Content Type Operations

BDCInfo24

Now save the SharePoint Designer and it will automatically deploy the external content type into SharePoint server. If you go to the central administration site you can see the external content type has been deployed. Application ManagementManage Service ApplicationsBusiness Connectivity Services.

BDCInfo25

Now we go to the site and create an external list. Go to Site ActionsView All Site Content

BDCInfo26

Click Create button on top of the page.

BDCInfo27

Select External List and click Create button on the right.

BDCInfo28

It will open the external list creation page. Type the name and select the external content type from the dialog and click Create

BDCInfo29

Lets see how it will look like.

BDCInfo43

This is how item view looks like

BDCInfo30

Just check the create, update and delete operations. smile_wink

Error:”The form has been closed” – InfoPath 2007

Here I got an error when I tried to attach custom InfoPath Initiation and Association forms to display in a SharePoint workflow. Depends on the IE session the error message differ. If you close the browser and reopened 2nd and 3rd error messages will appear.

InfoPathError1

InfoPathError2

InfoPathError3

Anyway this error message appear because of the xml statement in the workflow.xml. If you check your workflow.xml you can see the form URNs are written like this

<Association_FormURN>
    urn:schemas-microsoft-com:office:infopath:Test:-myXSD-2010-07-06T09-15-06
</Association_FormURN>
<Instantiation_FormURN>
    urn:schemas-microsoft-com:office:infopath:Test:-myXSD-2010-07-06T09-15-06
</Instantiation_FormURN>

To fix the problem, you have to remove the spaces between the xml tags like this. DO NOT keep any spaces between <> and </> tags.

<Association_FormURN>urn:schemas-microsoft-com:office:infopath:Test:-myXSD-2010-07-06T09-15-06
</Association_FormURN> <Instantiation_FormURN>urn:schemas-microsoft-com:office:infopath:Test:-myXSD-2010-07-06T09-15-06
</Instantiation_FormURN>

Please add a comment if you use this code or it helped you. So I can make my posts better.

Error: “Cannot access the local farm” – PowerShell command error

When working with PowerShell I got an error. First I thought I am making some kind of a  mistake because I am new to this as well smile_regular

PowershellError 

So I was struggling to make it happen and finally figured it out. The solution was to have administrator privileges to run PowerShell. So when you want use PowerShell don’t just click on it. Right click and Run as Administrator

PowershellError2

Bingo! Now you can use it.

PowershellError3


Please add a comment if you use this code or it helped you. So I can make my posts better.

Error: “SQL server has an unsupported version” when installing SharePoint 2010

This error message came when I was installing SharePoint Server 2010. You might not get this error all the time so first I’ll explain my environment which I tried to install SharePoint 2010. My OS was Windows Server 2008 R2 Standard 64-bit (6.1, Build 7600) and SQL Server 2008 Standard x64. So I started with SQL server which was a smooth installation and then started the SharePoint Server 2010. The setup installation went smoothly. But when it comes to the SharePoint 2010 Products Configuration Wizard, it asked the database server and credentials. So I gave the same name and credentials which I installed before. Then the error came

SP2010-Sql2008 error New

So I download the SQL Server 2008 Service Pack 1 and installed, restarted and tried again. Then I got the same error but the version number was different.

SP2010-Sql2008 error2 New

Went through everything again and finally found the solution. It was to install the Cumulative update package 2 for SQL Server 2008 Service Pack 1 on SQL server 2008.

Here are the links

SQL Server 2008 Service Pack 1
http://www.microsoft.com/downloads/details.aspx?FamilyID=66ab3dbb-bf3e-4f46-9559-ccc6a4f9dc19&displaylang=en

Cumulative update package 2 for SQL Server 2008 Service Pack 1
http://support.microsoft.com/hotfix/KBHotfix.aspx?kbnum=970315&kbln=en-us


Please add a comment if you use this code or it helped you. So I can make my posts better.

Calculate business days (weekdays) for a given two days using OOTB calculated field.

Recently I needed to calculate business days for a given start and end days. But I needed to do this using OOTB calculated field. This formula has to remove Saturdays and Sundays (Weekends) from the given start and end dates. Here I check if dates are inserted. If not I return an empty string. I was struggling with functions in calculated fields and I was not allowed to use SharePoint object model. I tried so many ways and finally came up with the correct formula. I need to thank Sujeewa, who helped me out with the formula. Here is the formula. Happy coding smile_wink

=IF(ISERROR(DATEDIF(StartDate,EndDate,"d")),"",(DATEDIF(StartDate,EndDate,"d"))+1
-INT(DATEDIF(StartDate,EndDate,"d")/7)*2
-IF((WEEKDAY(EndDate)-WEEKDAY(StartDate))<0,2,0)
-IF(OR(AND(WEEKDAY(EndDate)=7,WEEKDAY(StartDate)=7),AND(WEEKDAY(EndDate)=1,WEEKDAY(StartDate)=1)),1,0)
-IF(AND(WEEKDAY(StartDate)=1,(WEEKDAY(EndDate)-WEEKDAY(StartDate))>0),1,0)
-IF(AND(NOT(WEEKDAY(StartDate)=7),WEEKDAY(EndDate)=7),1,0))


Please add a comment if you use this code or it helped you. So I can make my posts better.

Dropdown get to editable mode when more than 19 records in lookup fields

When you create a lookup field to reference data from another list, you will get a dropdown control to select data from that list. If you select “Allow multiple values” you will get a list box control with two buttons which you can select values. But have you ever seen an editable dropdown OOTB in SharePoint? I don’t think so. If you need to add an editable dropdown then you have to come up with your own custom control.

When you add more than 19 records to the lookup list, SharePoint automatically makes that dropdown list editable. This is because when you have lots of items in the dropdown, It’s very difficult to find an appropriate item. So SharePoint allows you to type in the dropdown and it’s automatically sorted. This is not a bug. This is a feature in SharePoint.

Let’s see some screenshots.

2010-06-18_164913

OK… I have two lists. “My Favorite Colours” has a lookup field to “My Colours”

2010-06-18_165801

“My Colours” has some colours in the list.

2010-06-18_165902 

Added the lookup field to “My Favorite Colours” list

2010-06-18_165922

When “My Colours” has 19 records, “My Favorite Colours” list’s edit form shows usual dropdown box (Un editable)

2010-06-18_170647

But when we added more than 19 it’s automatically gets to editable. You can type and it’s automatically gets sorted according to the typed character.

2010-06-18_170822

I know what you think now. Users can type any value and save to the list without checking the lookup values. Don’t worry SharePoint automatically checks the value and show an error message.


Please add a comment if you use this code or it helped you. So I can make my posts better.

SharePoint 2010 VM in 32 bit host machine

I was trying to install SharePoint 2010 VM in 32 bit machine last week and couldn’t do it. After hours of searching the web I found a solution for that. This is a very good article that explains how you can install SharePoint 2010 VM in 32 bit host machine. Since SharePoint 2010 only comes in 64x version it’s worth reading. Thanks for perete for publishing this article.

http://comunidad.terra.es/blogs/moss/archive/2009/07/18/howtocreateasharepoint2010vmin32bitshostmachine1of5.aspx

SharePoint Server 2010 Beta

As you're all waiting for SharePoint 2010, Now is the chance to taste it. Click here to download your SharePoint Server 2010 Beta version now.

Custom Master pages on SharePoint

Few months ago I wanted to create a custom master page for a SharePoint portal and after some research I found a way of customizing master pages on SharePoint. But I couldn’t post a blog about it. Here I am attaching my custom master pages and I will update this as I develop it further in the future. I will explain the ways of customization soon.

SpringnetMoss Intranet for Spring Global Services on MOSS 2007
DilmahMoss Intranet for another customer on MOSS 2007
HostedWss Hosted WSS site on WSS 3.0
Awesome SharePoint features in Visual Studio 2010

Few days ago MS has announced Visual Studio 2010. It contain many SharePoint project templates and grate features for SharePoint developers. Here is the short overview which Microsoft SharePoint Team Blog has given. Read more at Microsoft SharePoint Team Blog.

SharePoint Project and Project Item Templates

The following SharePoint specific project templates and project item templates are available in Visual Studio 2010:

Project Templates

· Empty SharePoint project
· Visual Web Part project
· Sequential and State Machine Workflow
· Business Data Connectivity Model
· Event Receiver
· List Definition
· Content Type
· Module Project
· Site Definition

Project Item Templates

· Empty Element
· Web Part
· User Control
· Application Page
· Association Form
· Initiation Form
· Business Data Connectivity Resource Item
· List Instance
· List Definition From Content Type
· Global Resources File

Besides above mentioned project templates, there are two import project templates for importing .WSP file contents and importing reusable workflows:

· Import Reusable Workflow
· Import SharePoint Solution Package

World Clock web part – SharePoint 2007

This is a clock web part shows digital clocks depends on the user needs. Thanks to anujpant for sharing this at codeplex. You can find the original source and wsp file here.

The original clock looks like this

Clock_Old

Customized clock will looks like this

Clock_New

You can download the customized source code here what I edited for my requirement.

I customized this with VS 2008. Here I wanted to display the city/country name beside the clock rather than displaying under the clock. So I added a new cell into the same row.

Then I wanted to remove clock skins. The original clock can select 4 color skins as the user wants. After deploying the clock I realized that displaying seconds is disturbing the users. It’s worse when you added more than 5 clocks. So without removing the seconds I hid it.

More Posts Next page »