Monday, June 7, 2010

List dispForm.aspx NewForm.aspx missing the editpage option

append “&PageView=Shared&ToolPaneView=2" to the querystring

Monday, May 3, 2010

Infopath Views

v

InfoPath - Get the current user without writing code
Posted Thursday, April 05, 2007 12:56 PM by Itay Shakury
I've just read IP team blog post about getting the current user's details using Web Services.
Actually the exact same result can be achieved without writing any code. It's a very common thing to do and I couldn't find any guide for that, so here it is:
* If you are already familiar with this, this post might still be useful. I have included the complete set of default properties get returned and their proper naming syntax at the bottom.
* This works at InfoPath as well as InfoPath Forms Services.
*Clayton Cobb has a great follow up post if you to take the this a step further.

With InfoPath opened go to Tools > Data Connections, and click 'add...' to add a new data connection to the form. This opens up the Data Connection Wizard.
We want to receive data from the WS about the current user, so choose receive data' and click next.
Our data source is a WS so choose 'Web Service' and next.
Now you will have to point the wizard to the WS. Type an address similar to this: http://ServerName/_vti_bin/UserProfileService.asmx and click next.
Here you get a list of all methods for that WS, choose GetUserProfileByName and click next.
In this screen you can specify what parameters are sent to the method, we are relying on the method's ability to return the current user name if no value is passed to it, so we will leave this as is (no value is passed to the method) and click next.
Click next and make sure 'Automatically retrieve data when form is opened' is checked.
Finish the wizard.
The GetProfileByName method returns a PropertyData array. You can think of it as a repeating table of name and value pairs.
So Now that you have a data connection that can get the current users, you can use it values. In this example I will show the user's first name in a textbox.

Add a textbox to the form.
Go to the first textbox's properties (double click it).
In the 'Default Value' part, click the 'fx' button next to the 'Value' field. this opens up the formula builder dialog.



Click 'Insert field or group'.



In the data sources drop down, choose the GetUserProfileByName data source.
Expand all groups under the 'dataFields' group, and choose the 'value' field. Don't click OK yet!



With data 'value' field selected, click the 'Filter Data...' button and 'Add...'.
In the first drop down (value) select 'Select a field or group...' and choose the 'Name' field under the 'PropertyData' group.




http://blogs.microsoft.co.il/blogs/itaysk/archive/2007/04/05/InfoPath-_2D00_-Get-the-current-user-without-writing-code.aspx


Leave the middle drop down as is ('is equal to') and in the last drop down choose 'type a text...'.



This is the part where you specify which property to put in the textbox. As we said the method returns multiple properties about the user. For this textbox we want to put the user's first name in, so type 'FirstName' (this is case sensitive!). I have included the property list you can use here (just below), so if you want some other property, just type its name instead.
That's it, all we have to do is to confirm everything so Click 'OK' for every open dialog box until you are back in the design mode.
click 'Preview' and see the wonder!
If you want more details repeat steps 1-11 and enter different property names in step 10

Monday, April 26, 2010

Site Denition

Site Definition

•Site Definitions are the foundations on which all sites and user templates are built.
•Site Definition is collection ox XML and .aspx file.
•Site Definitions are predefined components needs to be included when a site was created in SharePoint server.
•Site Definition contains information of Web Part , Lists, Features and navigation bars to be included in the site.
•Customizing Portal Sites and other SharePoint sites using Site Definition is most appropriate for third party developer and SharePoint Administrator.
•Site Definitions requires access to a file system of the Web Server.
•Server administrator must be also involved in deployment of Site Definitions.
•Custom Site Definitions are Version and Upgrade independent.
•Subsequent upgrades to SharePoint products and technologies may overwrite existing Site Definitions. Using Custom Site definition exclude site from potential upgrade issues.
•To avoid Unghosting , Custom Site Definition is to be create.
•There are two options to create it
1.Create New Site Definition File : Either Start from Scratch and create files one by one or Copy an existing Site Definition and modify it.

2.Copy a Site Definition and change it in Visual Studio: We can make copy an existing site definition and modify it in visual studio to create new site definition.

•The configuration of this site definitions are defined in XML file which is available in

C:\Program Files\Common Files\Microsoft Shared\web server extensions\12\TEMPLATE\1033\XML folder.

•In the file system these definitions are available in C:\Program Files\Common Files\Microsoft Shared\web server extensions\12\TEMPLATE\Site Templates.

•Each of these site definitions consists a XML folder and a Home page (default.aspx).

Steps to create custom Site Definition

1. Log on as an administrator

2. Browse to C:\Program Files\Common Files\Microsoft Shared\web server extensions\12\TEMPLATE\SiteTemplates.

Copy STS folder-> Paste it at same place -> Rename it as TIGER.

3. Open the folder Tiger

4. Search for default.aspx

5. Open default.aspx in notepad.

6. Modify code. Here we need to add code for site definition.

Default.aspx

<%@ Page language="C#" MasterPageFile="~masterurl/default.master"
Inherits="Microsoft.SharePoint.WebPartPages.WebPartPage,Microsoft.SharePoint,Version=12.0.0.0,Culture=neutral,P
ublicKeyToken=71e9bce111e9429c" %> <%@ Register Tagprefix="SharePoint"
Namespace="Microsoft.SharePoint.WebControls" Assembly="Microsoft.SharePoint, Version=12.0.0.0, Culture=neutral,
PublicKeyToken=71e9bce111e9429c" %> <%@ Register Tagprefix="Utilities"
Namespace="Microsoft.SharePoint.Utilities" Assembly="Microsoft.SharePoint, Version=12.0.0.0, Culture=neutral,
PublicKeyToken=71e9bce111e9429c" %> <%@ Import Namespace="Microsoft.SharePoint" %> <%@ Register
Tagprefix="WebPartPages" Namespace="Microsoft.SharePoint.WebPartPages" Assembly="Microsoft.SharePoint,
Version=12.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %>

EncodeMethod="HtmlEncode"/> -

SRC="/_layouts/images/blank.gif" width=1 height=1 alt="">












ControlId="SmallSearchInputBox" />






















NodeStyle-CssClass="ms-sitemapdirectional" runat="server"/>
runat="server"/>














Title="loc:Left" />
 
 
Title="loc:Right" />
 
 


Title="loc:Bottom" />



7. Register new site definition to SharePoint.

8. Open the folder

C:\Program Files\Common Files\Microsoft Shared\web server extensions\12\TEMPLATE\1033\XML

9. Copy the file WEBTEMP.XML and save it as WEBTEMPTIGER.xml. here make a note that , we need to append name of folder which we created in step 2 ( in this case it is tiger) to WEBTEMP. So here name would be WEBTEMPTIGER.xml

10. Open WEBTEMPTIGER.XML in notepad and replace it with following content.









Make sure here ID should be greater than 10000. It must not collide with id of any other Site Definition.

11. Restart IIS. Go to Start->Run->IISRESET

12. Now you would be able to see this Site Definition inside Custom category

Saturday, March 27, 2010

HRESULT: 0x81070201 Exception

HRESULT: 0x81070201 Exception
Okay okay, this is actually something very basic, but it happend now a couple of times to me. If you work on a Feature that defines a custom SharePoint List, you can run into the following Error while activating it (in this case during Site Provisioning by definitions in onet.xml):

The element 'MyList' of type 'ListInstance' for feature 'MyListFeature' (id: 794958c5-fede-4e1f-aa96-d9fcd087945e) threw an exception during activation: Exception from HRESULT: 0x81070201

The reason for this error is, that SharePoint can't find the related schema.xml file for the list to define. This can happen, if


You simply forgot to write an schema.xml file

or, what is more realistic, the Name Attribute in ListTemplate is not the same as the Folder Name you have the schema.xml File stored in.

The Name-value of the ListTemplate tag must match the name of the folder you have your schema.xml file stored in:


Name="MyListDefinition"
Category="Custom Lists"
DisplayName="MyList"
...

Thursday, March 25, 2010

Unable to load symbols

While working on a Sharpoint project suddenly i got the following error Unable to load symbols and break point was not being hit.

Reason: The GAC had an older version. Update it !!!

Wednesday, March 24, 2010

Unable to select / Import wepart

Check if the dll has class using reflector
Make sure the class is public
install in Gac
IIS reseet

Wednesday, March 17, 2010

Check if SPLIst exist

static bool ListExists(SPWeb web, string listName)
{
return web.Lists.Cast().Any(list => string.Equals(list.Title, listName));
}


static bool WebExists(SPSite site, string webName)
{
return site.AllWebs.Cast().Any(web => string.Equals(web.Name, webName));
}

http://whatsthesharepoint.com/2010/01/easy-check-if-an-spwebsplist-exist/