Search This Blog

Total Pageviews

Tuesday, June 28, 2011

Sharepoint Datasheet view is not working in office 2010

The 64bit version of office 2010 leaves us a bit wanting. For those users that uninstall Office 2007 and install the new 64 bit addition, a host of feature will not work without the addition of the 2007 Office System Driver Data Connectivity components.
Here are the details on what is supported:
“Datasheet view
Requires a 64-bit ActiveX control. Microsoft Office 2010 does not provide a 64-bit version of this control.”
Download and install the 2007 Office System Driver: Data Connectivity Components

The 2010 component can be found at Microsoft at:

Monday, June 27, 2011

SharePoint user profile properties read / Modify using object model

//Updates a user profile
//Creates a user profile. Obtains the property values from the default 
//domain controller or the master connection that is configured on the 
using System;
using System.Collections.Generic;
using System.Text;
using Microsoft.SharePoint.Administration;
using Microsoft.Office.Server.UserProfiles;
using Microsoft.SharePoint;
using Microsoft.Office.Server;
using System.Web;

namespace UserProfilesApp
    class Program
        static void Main(string[] args)
                using (SPSite site = new SPSite("http://servername"))
                    SPServiceContext context = SPServiceContext.GetContext(site);
                    UserProfileManager profileManager = new UserProfileManager(context);
                    string sAccount = "domainname\\username";
                    UserProfile u = profileManager.GetUserProfile(sAccount);
                    u[PropertyConstants.HomePhone].Value = "nnnnnnnnnn";
                    u[PropertyConstants.CellPhone].Value = "nnnnnnnnnn";

            catch (UserNotFoundException exception)



function getUserProfile(userID)
var clientContext = new SP.ClientContext.get_current();
var web = clientContext.get_web();
var userInfoList = web.get_siteUserInfoList();
var camlQuery = new SP.CamlQuery();
camlQuery.set_viewXml(‘<View><Query><Where><Eq><FieldRef Name=\’ID\’/>’ +’<Value Type=\’Number\’>’ + userID + ‘</Value></Eq>’ +
this.collListItem = userInfoList.getItems(camlQuery);
clientContext.executeQueryAsync(Function.createDelegate(this, this.onQuerySucceeded),Function.createDelegate(this, this.onQueryFailed));
function onQuerySucceeded(sender, args)
var item = collListItem.itemAt(0);
var profile = item.get_item(‘Notes’);
var pictureUrl = item.get_item(‘Picture’).get_url();
var userImage = document.getElementById(‘myImageContainer’); -> Image object
userImage.src = pictureUrl;
var profileDiv = document.getElementById(‘userProfileContainer’);
profileDiv.innerHTML = profile;

Configure My Site in SharePoint 2010

Sunday, June 26, 2011

Microsoft Webmatrix

SharePoint Calendar & Meeting Workspace

Tips & Trics :

1. SharePoint 2010 Meeting workspace recurrance date if you clicked its showing the javascript error means - update the Apr 27th cummulative update then it will work perfectly.

2. Under meeting workspace subsite creation is not available.

3. when you delete any calendar item if its contains any recurrance meeting - then actually it not getting delete thats the reason item  Deleting, Deleted event will not triggered.

Actually it will concate the title value Deleted:meetingtitle and point as deleted icon as well, so item updating and updated event only will trigger

Dymanic Header Color For your Webparts

Paste the below script on your Content Editor Webpart, put this webpart in the footer zone.
All webparts will render based on the color specified in the Array order.

  1. <script type="text/javascript">
  2. var bcol=new Array("#E18B6B", "#F665AB", "orange", "rose", "blue");
  3. var rcnt=0;
  4. var x= document.getElementsByTagName("TD");
  5. for(var i=0;i<x.length;i++)
  6. {
  7. if(x[i].title !="Forums" && x[i].title !="")
  8. {
  9. if(rcnt == 5)
  10. rcnt=0;
  11.  var td =x[i];
  12. var row =td.parentNode;
  13.  for (var j = 0, col; col = row.cells[j]; j ++) {
  14. =bcol[rcnt];
  15.    }  
  16. =bcol[rcnt];
  18. rcnt =rcnt +1;
  19. }
  20. }</script>

Show Ribbon Permission based

you can open the master page add the permissionstirng then ribbon control will appear only if the user has manage web permission only.

<SharePoint:SPRibbon runat="server" PermissionsString="ManageWeb"

Thursday, June 23, 2011

3D TagCloud for SharePoint 2010

Sharepoint Workspace

How to Remove Workspace Link from a Calendar

First, we need to provision a new calendar with our custom Feature:

<?xml version="1.0" encoding="utf-8" ?>
    Title="Calendar without Workspace Link"
    Description="Installs a new calendar without workspace link."
        <ElementManifest Location="Lists.xml"/>

<?xml version="1.0" encoding="utf-8" ?>
<Elements xmlns="">
        Description="Event calendar..."
And the most important part of it, the Feature Receiver:

public override void FeatureActivated(SPFeatureReceiverProperties properties)
    var web = properties.Feature.Parent as SPWeb;
    if (web == null) return;
    using (web)
        var list = web.Lists["Events"];
        var field = list.Fields[SPBuiltInFieldId.WorkspaceLink];
        field.Hidden = true;
You can use the code for example in a PowerShell too, if you need to modify existing calendar. It seems like you can edit sealed content types’ fields’ Hidden property without errors. I also tried deletion, but it didn’t work. ShowInNewForm property didn’t have any effect either. Finally the Hidden property worked just fine.

Having then done that I realised that you could edit the Event content type to make it hidden across the entire site collection

Monday, June 20, 2011

Hide the SharePoint Page Ribbon - Programatically

            SPRibbon oribbon = SPRibbon.GetCurrent(this.Page);
            if (oribbon != null)
                //hide the ribbon buttons on the wiki page

                //hide the ribbon menus on the webpart page

Reference :
 Microsoft.Web.CommandUI DLL

Default Server Ribbon Customization Locations:

SharePoint 2010: How to remove preview button from Ribbon of Wiki Page

SharePoint 2010 - Hide Ribbon buttons Programatically

Hide Ribbon(whole Ribbon)
SPRibbon ribbon = SPRibbon.GetCurrent(this.Page);
if (ribbon != null)
What is this RibbonGroupId ? Well the idea is to hide all the groups in the ribbon and the whole ribbon will be trimmed. To get the id’s for ribbon groups, Open the file C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\14\TEMPLATE\GLOBAL\XML\CMDUI.XML in Internet Explorer and search for “Ribbon.EditingTools.CPEditTab.Groups
The sub-nodes are the ones you’re interested in – a collection of GROUP nodes. The groups should look familiar – they correlate to the panes on the ribbon pane :
o Ribbon.EditingTools.CPEditTab.EditAndCheckout
o Ribbon.EditingTools.CPEditTab.Clipboard
o Ribbon.EditingTools.CPEditTab.Font
o Ribbon.EditingTools.CPEditTab.Paragraph
o Ribbon.EditingTools.CPEditTab.Styles
o Ribbon.EditingTools.CPEditTab.Layout
o Ribbon.EditingTools.CPEditTab.Markup
so to trim the while ribbon just use the ribbon groups like below
for e.g . ribbon.TrimById(“Ribbon.EditingTools.CPEditTab.EditAndCheckout”);
Side Note : You can add this code in a custom web user control and the control to the master page.
Hide a single Button on Ribbon –
Copied from our Forum Post Here the goes goes as below :
public void HideRibbonButton()
//if this is a System.Web.UI.Page
SPRibbon ribbon = SPRibbon.GetCurrent(this);
Hide group –
As seen in the first scenario you can use groupid to hide the ribbon groups like below

Loading this assembly would produce a different grant set from other instances

Loading this assembly would produce a different grant set from other instances

After installing .NET 3.5 sp1, all the MOSS web applications were working fine except for one. The following error was showing up:
Stack trace:
at System.RuntimeTypeHandle.CreateInstance(RuntimeType type, Boolean publicOnly, Boolean noCheck, Boolean& canBeCached, RuntimeMethodHandle& ctor, Boolean& bNeedSecurityCheck)
at System.RuntimeType.CreateInstanceSlow(Boolean publicOnly, Boolean fillCache)
at System.RuntimeType.CreateInstanceImpl(Boolean publicOnly, Boolean skipVisibilityChecks, Boolean fillCache)
at System.Activator.CreateInstance(Type type, Boolean nonPublic)
at System.RuntimeType.CreateInstanceImpl(BindingFlags bindingAttr, Binder binder, Object[] args, CultureInfo culture, Object[] activationAttributes) at System.Activator.CreateInstance(Type type, BindingFlags bindingAttr, Binder binder, Object[] args, CultureInfo culture)
at System.Web.Configuration.Common.ModulesEntry.Create()
at System.Web.Configuration.HttpModulesSection.CreateModules()
at System.Web.HttpApplication.InitInternal(HttpContext context, HttpApplicationState state, MethodInfo[] handlers)
at System.Web.HttpApplicationFactory.GetNormalApplicationInstance(HttpContext context) at System.Web.HttpApplicationFactory.GetApplicationInstance(HttpContext context)
at System.Web.HttpRuntime.ProcessRequestInternal(HttpWorkerRequest wr)


Check the web applications are running in the Farm Account only and Just restart the application pool account associated with the erroring application and you be all set.

Thursday, June 16, 2011

InfoPath - Setting Parameters on Web Service Calls when a form loads

When you have a secondary data source that uses a web service, InfoPath lets you specify the input parameters.

You can set the value here to any simple data type.  However, it's not immediately apparent how you would set the value to a variable data item.  In this case I wanted to fetch some data for the currently logged in user.  This data is then used to pre-populate the form.
InfoPath has a username() function.  To use this to specify the value to the web service you need to create a rule for the Form.

1.     Select Tools/Form Options.
2.     Select Open and Save.
3.     Click Rules.
4.     Add a new rule.
5.     Add an action to set a field value.
6.     For the field, select your web service as the data source and the input parameter you want to set.
7.     Set the value to a function or some other calculated value.
8.     Add more actions if you have more input parameters.
9.     Add a final rule to submit the query for the web service.
Ensure that the data connection for the web service has the "Automatically retrieve data when form is opened" option turned off.

The web application at [URL] could not be found. Verify that you have typed the url correctly. If the url should be serving existing content, the system administrator may need to add a new request url mapping to the intended application

Error : The web application at [URL] could not be found. Verify that you have typed the url correctly. If the url should be serving existing content, the system administrator may need to add a new request url mapping to the intended application.

I am trying to create a web service that will retrieve the data from the SharePoint List Item details but when SPSite object constructor its throwing  the above exception.

Solution :

Then i did the following changes :

1. Publish the web service.
2. Disable all authentication except windows authentication.
3. Change the Application pool Account to Farm Admin Account

Tuesday, June 14, 2011

Infopath XPathNavigator

Working with XML Data Using the XPathNavigator Class

Setting the Value of a Node That Has the xsi:nil Attribute

For certain data types, trying to set the value of a blank field programmatically raises the error "Schema validation found non-data type errors." Typically the cause of this error is that the element has the xsi:nil attribute set to true. If you examine the underlying XML element for the blank field in the form, you can see this setting. For example, the XML fragment for the following blank Date field has the xsi:nil attribute set to true.

<my:myDate xsi:nil="true"></my:myDate>
If the xsi:nil attribute is set to true, it indicates that the element is present but has no value, or in other words, is null. If you try to programmatically set the value of such a node, InfoPath displays the "Schema validation found non-data type errors" message because the element is currently flagged as being null. InfoPath sets the xsi:nil attribute to true for null fields of the following data types:
  • Whole Number (integer)
  • Decimal (double)
  • Date (date)
  • Time (time)
  • Date and Time (dateTime)
To prevent this error, your code must test for the xsi:nil attribute, and if it is present, remove it before setting the value of the node. The following subroutine takes anXpathNavigator object positioned on the node you want to set, checks for the nil attribute, and then deletes it, if it exists.

public void DeleteNil(XPathNavigator node)
   if (node.MoveToAttribute(
      "nil", ""))

Thursday, June 9, 2011

SharePoint 2010 Branding

Real World Branding with SharePoint 2010 Publishing Sites

The most important source of information is the SDK. I can’t stress that enough. There is so much more documentation with this release than there was with 2007. However, we are all in the habit of looking to each other for information first. Researching the SDK and walking through the Development classes, even if you aren’t a developer. is an important step in understanding the complex relationships between the objects in SharePoint and ASP.NET.

Planning Strategy and Design

Visual Design


Wireframes and prototypes

Web Content Management


Microsoft SharePoint Designer 2010


CSS and HTML Resources

SharePoint 2010 requires a better understanding of CSS than you needed in SharePoint 2007. You really should be able to plan your css. If you can use the box model on purpose. If you know how to clear a float. If you understand a stacking index, you are okay. If you don’t, practice on plain old HTML first. Build your own HTML from scratch and style it. Draw a design and build it from scratch Plan it.
CSS Sticky Footer You may find yourself struggling to get your footer to stay at the bottom of your page. If you really want this to be a part of your site, test the layout and structure all alone to troubleshoot. Test with and without content on as many site templates as possible.


General SharePoint CSS and Markup

Master Pages

Starter Master Pages

Master Page Tips and Tricks that will save your ARSE

Simply Cool Tips and Tricks

Upgrading 2007 Designs