Visual Studio 2010 likes SharePoint

Jason Zander, General Manager for Visual Studio, recently announced Visual Studio 2010 Tools for Sharepoint.


Items addressed in Zander's TechEd EMEA keynote:

Building and Debugging
Visual Studio will be able to building and debug SharePoint projects. "F5 Just Works!"

Server Explorer Integration
SharePoint Connections will be an option in the VS Server Explorer. Standard Sharepoint artifacts will be viewable: ContentTypes, Features, Templates, Lists, Sites, Workflows, Workspaces. Direct manipulation of some artifact attributes will be supported through VS property grid integration.

Windows SharePoint Services Project (WSP) Import
This will automate the manual task of creating Windows SharePoint Services solution package files. Previously, to create a solution package file, a developer had to use the Makecab.exe console application that is included in the Microsoft Cabinet Software Development Kit (SDK). Makecab.exe requires specifying the Diamond Directive File (.ddf) that contains a list of all the files to include in the package. Much of this will be automated.

Visual Web Part Designer
A new WSYWIG designer will exist for authoring Web Parts. The designer will also load a user control as a web part for SharePoint. This seems to be a more tightly integrated version of the widely-used SmartPart, which is a Web Part that allows hosting of ASP.NET User Controls in SharePoint.

Event Receiver Wizard
Adding Event Receivers and connecting them to Sources can be done visually through a wizard.

Workflow Integration
A new ASPX Workflow Initiation form for Workflow Project will be added. Workflow initiation forms will have a visual designer.

Packaging Editor
A new Packaging Explorer will exist that supports editing Packaging and structuring the SharePoint Features and WSP file.

Thanks Al Tenhundfeld for bringing this to us.

Display Username for the Logged on user on a page through a DataView

It is been a long time that I had penned down on Sharepoint Tip, One of our prestigious Client wanted me to display Current Logged on User Name, So here we go on Some Useful TIPS, The restriction was not to use the SharePoint Control i.e '<'wssuc:Welcome id="IdWelcome" runat="server" EnableViewState="false"'>' ''. But we can't write server-side code in SharePoint ASPX pages. The way I get around this limitation is to code XSLT and make it do what I want.


1. Insert a Data View Web Part on the Page. From any of the Lists drop a Title column on that dataview.

2. Click on Data > Conditional Formatting

3. Select any data value and Click on Create

4. Click on Show Content under conditional formatting.

5. Create a Condition that says: Title EQUALS [Current User] and click OK back to the Design view

6. Type “Welcome to this site“ inside one of the Table cells

7. Switch to Code view

8. Find the following code:

'<'ParameterBinding Name="UserID" Location="CAMLVariable" DefaultValue="CurrentUserName"'/>'

9. Change this code to this:

'<'ParameterBinding Name="UserID" Location="CAMLVariable;ServerVariable(LOGON_USER)" DefaultValue="CurrentUserName"'/>'

10. Scroll up in the code and find “Welcome to this site”

11. Change code in front of your Welcome Message to this: “'<'xsl:value-of select="$UserID"'/>'

12. Save the page.

Hope this works for you !

Sharepoint & Azure

Here is the extract from SharePoint's official blog, we hope to see more of Azure and Wss in coming days.

In the Azure Services Platform, a number of developer services were mentioned including Microsoft SQL Services, Microsoft Dynamics CRM Services & Microsoft SharePoint Services. Keep in mind that this not the same as Windows SharePoint Services 3.0 which shipped in Windows Server.  Microsoft SharePoint Services is a developer service that will be available as part of Azure in the future. (Possibly the infrastructure on same line will be available for silveright in next version of sharepoint)
 
The keynote also emphasized Microsoft’s investment in cloud applications that developers can extend and customize. Specifically, David Thompson (VP of Online Services) talked about Microsoft SharePoint Online  and demonstrated how developers can write code against SharePoint Online web services as well as make customizations with SharePoint Designer. For example, using the Data View Web Part to surface data from an external source – this could be a web service living in Windows Azure. In fact, later in the week at PDC, there’s a breakout session that walks through the different ways SharePoint Online can be customized.
 
Here are answers to a few frequently asked questions:
 
What is Microsoft SharePoint Services in Azure?
In the future, developers will have access to SharePoint functionality in the Azure Services Platform (“Microsoft SharePoint Services”). With the flexibility to use familiar developer tools like Visual Studio, developers will be able to rapidly build applications that utilize SharePoint capabilities as building blocks for their own applications. Developers can expect a breadth of SharePoint capabilities across the spectrum of on-premises, Online and the Azure Services Platform.
 
Where can I find more information about Microsoft SharePoint Services in Azure?
We have not announced any further detail or release dates. We will release more information about this in the future.
 
How do developers get ready for Microsoft SharePoint Services?
Keep developing on SharePoint technology (MOSS, WSS, SharePoint Online)! You can learn more about SharePoint Development here.

"Sharepoint" Search Trend

The Search trend for "Sharepoint" on google seems interesting
Europe in lead with India and US is a welcome trend. I guess that Europe as combined will be ahead of India & US.

Regions
1.India
2.Singapore
3.United States
4.Russia
5.Australia
6.Denmark
7.Netherlands
8.Switzerland
9.Canada
10.United Kingdom
 Cities
1.Redmond, WA, USA
2.Bangalore, India
3.Mumbai, India
4.Singapore, Singapore
5.Washington, DC, USA
6.Seattle, WA, USA
7.Minneapolis, MN, USA
8.Houston, TX, USA
9.Atlanta, GA, USA
10.Amsterdam, Netherlands
 Languages
1.English
2.Danish
3.Dutch
4.Russian
5.Swedish
6.German
7.Chinese
8.Japanese
9.French
10.Italian


And for "Moss 2007"

 Regions
1.India
2.Singapore
3.Norway
4.Ireland
5.Denmark
6.Israel
7.Australia
8.United States
9.Sweden
10.Switzerland
 Cities
1.Bangalore, India
2.Chennai, India
3.Mumbai, India
4.Delhi, India
5.Singapore, Singapore
6.Dallas, TX, USA
7.Washington, DC, USA
8.Houston, TX, USA
9.London, United Kingdom
10.Chicago, IL, USA
 Languages
1.Danish
2.English
3.Swedish
4.Dutch
5.Russian
6.Chinese
7.French
8.German
9.Italian
10.Spanish

Adding a Infopath form Programmaticaly from a webpart

Adding a Infopath form programmaticaly seems like a piece of cake by following method:

First, add a blank form in the library, which we'll access from the code/web part, edit as a copy and add to the library.

private void button1_Click(object sender, EventArgs e)
        {
            SPSite site = new SPSite("http://Site/SubSite");
            SPWeb web = site.OpenWeb();
            string strURL = ((SPDocumentLibrary)(web.Lists["Forms"])).DocumentTemplateUrl;
            
            // Gets the blank file to copy
            SPFile BLANK = web.Folders["invoices"].Files["master.xml"];
            
            // Reads the blank file into an xml document
            MemoryStream inStream = new MemoryStream(BLANK.OpenBinary());
            XmlTextReader reader = new XmlTextReader(inStream);
            XmlDocument xd = new XmlDocument();
            xd.Load(reader);
            reader.Close();
            inStream.Close();

            //Get the XML Document
            XmlNamespaceManager nm = new XmlNamespaceManager(xd.NameTable);
            nm.AddNamespace("my", "http://schemas.microsoft.com/office/infopath/2003/myXSD/2008-11-08T15:12:28");
            XmlNode node = xd.SelectSingleNode("//my:Title",nm);
            OperateNode(ref node); 

            // saves the XML Document back as a file
            System.Text.ASCIIEncoding encoding = new System.Text.ASCIIEncoding();
            SPFile newFile = web.Folders["Forms"].Files.Add("Test_Document.xml", (encoding.GetBytes(xd.OuterXml)), true);
        }

In this way, a new form with custom node values will be submitted to the Infopath library. The above method is very much dependent on the BLANK.XML form in the library, hence it will be good idea to hide the blank form from the default view.

Add Link to Edit Menu of Sharepoint's list Item

Here is a simple feature sample to Sharepoint's item edit menu, it adds a custom item in the menu which opens a pop-up menu.



Feature.XML
<  Feature id="12b05c5c-c240-4619-bbd2-d9a42636ce85" 
          Title="Add Link to Edit Menu"
          Description="Add Link to Calendar's Edit Menu"
          Version="12.0.0.0"
          Hidden="FALSE"
          Scope="Web"
          DefaultResourceFile="core"
          xmlns="http://schemas.microsoft.com/sharepoint/" >
  < ElementManifests >
    < location="elements.xml">
  < /ElementManifests >
< /Feature >
Elements.XML
<  
   Elements xmlns="http://schemas.microsoft.com/sharepoint/"  >
  <
    CustomAction
    Id ="_AddLink"
    Location="EditControlBlock"
    Title ="Invoice"
    RegistrationType ="List"
    RegistrationId ="106"  >    (for registrationid values, see my previous post)
   <     UrlAction Url=""
     / >
  < /CustomAction >
    < /Elements >

In the UrlAction, to open  a pop-up simple add :

UrlAction Url="javascript:window.open('{SiteUrl}/Pages/GetReport.aspx?item={ItemId}&List={ListId}','invoice','height=255,width=250,toolbar=no,directories=no,status=no,
menubar=no,scrollbars=no,resizable=no ,modal=yes');"

This feature adds the link to edit menu of an item for a specific list, if you want to add the link to all lists/libraries then change:

RegistrationType="ContentType"
RegistrationId="0x01"

SharePoint Features RegistrationId

Thanks to Mike Smith , for the list of RegistrationId for SharePoint features:


RegistrationId List Template Type IDs:

InvalidType = -1
GenericList = 100
DocumentLibrary = 101
Survey = 102
Links = 103
Announcements = 104
Contacts = 105
Events = 106
Tasks = 107
DiscussionBoard = 108
PictureLibrary = 109
DataSources = 110
WebTemplateCatalog = 111
UserInformation = 112
WebPartCatalog = 113
ListTemplateCatalog = 114
XMLForm = 115 (InfoPath Forms Library)
MasterPageCatalog = 116
NoCodeWorkflows = 117
WorkflowProcess = 118
WebPageLibrary = 119
CustomGrid = 120
DataConnectionLibrary = 130
WorkflowHistory = 140
GanttTasks = 150
Meetings = 200
Agenda = 201
MeetingUser = 202
Decision = 204
MeetingObjective = 207
TextBox = 210
ThingsToBring = 211
HomePageLibrary = 212
Posts = 301
Comments = 302
Categories = 303
Pages = 850 (thanks to Anders Jacobsen for this one)
IssueTracking = 1100
AdminTasks = 1200

Translation Management Library = 1300
Languages & Translations = 1301