Friday, August 13, 2010

Changing i like it ,change notes butoon to small icons in sharepoint 2010 ribbon

To convert the large social buttons to smaller ones you simply have to modify the following:

Within your custom Master Page search for: “GlobalSiteLink3”

Simply Add “-mini” to the control ID

Original Large Control:




New Small Control ID:





If you want to make the small buttons horizontal versus vertical simply add the following to your custom CSS:

.ms-mini-socialNotif-Container{
white-space: nowrap;
}

Wednesday, August 11, 2010

Back up and Restore

1)Create content database backup for particular sharepoint website
2)Delete web application along with content database if it is same server
3)restore the back up what you have create in first step
4)Create new web application,While creating give database name as same as what you ahve restore.
5)after creating web applicationdon't create any site collection
6)Just close the window and open site with url directly in browser
7)The backup site will open in new web application(new url) same as like deleted site.

Monday, August 9, 2010

Column Validation in SharePoint 2010

The ability to easily validate the column values entered into list items is a welcome addition to SharePoint 2010. I'd like to walk thru 2 simple example s of how to use column validation, at the column level, then at the list level. I'll then point out some specific notes about this feature.

Simple Example #1 - Column Level
Create a new column on a list, and click "Column Validation":



2.Add a validation Formula, and a message that will display if validation fails:




3.Create a new item, and enter a value that will not validate. Click OK. You will see your failure message:




Simple Example #2 - List Level
In the List Settings, click on "Validation Settings"




Enter a validation formula to apply to this list. Click Save.





Create a new list item, entering in values that will not validate. Click OK. The item does not save, but the User Message doesn't appear either. I assume this is a bug, and it ought to be fixed before RTM.



Field Types
In this simple example we used a "Single Line of Text" field type. The following field types can be validated with the "Column Validation" feature:
Single Line of Text
Choice (single only)
Number
Currency
Date & Time

Formulas
You can only compare column values to one another in a list level validation.
A validation formula at the column level cannot include any other columns besides itself. For example, [Column1]>[Column2] is an invalid formula and SharePoint will not allow it to be used at the column level. In this case, you want to use list-level validation.
There is only one formula available at the list level.
The formula syntax is similar to that used in Calculated Columns
There are a few dozen functions available - I have not tried every one. One interesting thing to note is that SharePoint 2010 would not allow me to use the TODAY function, even when validating a Date field. [DateColumn]>TODAY is not a valid validation formula.

Conflicts
What if you have both column level validation and list level validation?
The column level formulas will be evaluated first, then the list formulas
What if the column and list level validations are in conflict?
Example - at the list level, you require that [Text1] = [Text2], but each column has it's own validation; [Text1]="AAA", and [Text2]="BBB". In this case, it will be impossible to actually submit a list item. The column validations are evaluated first, but if the values validate here, they will of course fail the list validation.
What if the list level validation includes columns not included in a particular content type?
If a column used in the list formula isn't available in the current content type, validation will always fail. This means that if you have multiple content types in your list, you should not validate at the list level for a column that is not included in all content types on the list. These columns can only be validated at the column level.

Site Columns
You can set validation on custom columns of the field types listed above
You can override the validation of a site column at the list level

Items To Investigate
How does validation behave with page fields in a Pages library on a publishing site?
How does validation behave in Office client applications?
Is validation available in the Site Directory? Does it work at site creation time?
Can we use regular expressions in a validation formula?

Cascading Drop-Down List in SharePoint 2010 using InfoPath 2010

Cascading drop-down is a common business requirement. SharePoint 2007 does not support cascading drop-down list by default. User have to write custom SharePoint field and it’s not easy to implement. With SharePoint 2010, User able to customize SharePoint form in easy way by using the powerful of InfoPath Designer. Following is the step guides to create a cascading drop-down list solution in SharePoint 2010 without require a lot of IT knowledge.
Scenario: We build a cascading for Address List. We have three list: City, District and Ward
1. Create City List
- In SharePoint 2010, create a custom List and named as “City”
- Add Two Item to this list: Hanoi and TP HCM
2. Create District List
- In SharePoint 2010, create a custom List and named as “District”
- Create a Lookup column named as “City”. This column get information from City List in the column Title.
- Add 4 items to District list




3. Create Ward List
- In SharePoint 2010, create a custom List and named as “Ward”.
- Create a Lookup column named as “City”. This column get information from City List in the column Title.
- Create a Lookup column named as “District”. This column get information from District List in the column Title.
- Create on Add new Item link you will see. When we choose City, District still have 4 item.




4. Customize Ward form to meet cascading requirement
- In Ward List, click on Customize Form ribbon button



- System will automatically open the form template of Ward list in InfoPath Designer



- Right click on District drop-down list control then select Drop-Down List box Properties from menu to open the properties windows






- In Data Source. Click on Add button
- In Data Connection Wizard, click on Next button




- In Select the source of your data, choose SharePoint library of list then click Next button





- In SharePoint Site details screen, click on Next button




In Select a list of library, choose District the click on Next button






In select fields: Choose Title, City, ID then click on Next button




In next screen, choose Next button



- Leave the default name for the connection as “District1” then click Finish button



Now, You will see the Data Source of Drop-Down list box is District1



- In Entries section, click on the tree button to select XPath
- In Select a Field or Group dialog, click on Filter Data… button



- In Filter Data click on Add… button




- In specify Filter Conditions, in the first drop-down list choose Select a field or group




Select a Field or Group opened. Select District1 as Data Source, choose City in dataFields then click OK



In specify Filter Conditions, in the last drop-down list choose Select a field or group



Select a Field or Group opened. Select Main as Data Source then choose City in dataFields then click OK






Click on OK to close specify Filter Conditions dialog
- Click on OK to close Filter Data dialog
- Click on OK to close Select a Field or Group
- In Drop Down List box properties, choose d:ID in Value: section then click OK to close this



- In InfoPath Designer, close the Windows then choose the Save and Publish button





- After Publishing complete, back to Ward list then click on Add new item link. You will see the result






Two drop-down list has been cascading.

Sunday, August 8, 2010

Access denied while accessing External content type through External List(BDC)

You may encounter “Access denied by Business Data Connectivity” error when trying to access External List. The reason is because External List requires External Content type ; and External Content type is using Business Data Connectivity services proxy to access external Data Source. With the same principle of BDC in MOSS 2007 – users are required to have BDC Object permission before they can use it. There are several set of permission available for the BDC

Edit
- Execute
- Selectable in Clients
- Set Permissions

How to configure the BDC access rights?

1. Open Central Administration page, and click on Manage service application.




2)2. Click on Business Data Connectivity Service




3. Open the context menu of the External Content type (ie. External CT in this example). Click on Set permissions.



4. Add account (Group, or User) and assign the permissions.



5. Set appropriate permission to the BDC object. Remember that BDC object permission rules the interaction between user and external data source through BDC object. It doesn’t rules his/her permission accessing Forms in the list (New / Edit / Delete form).

Error occured in deployment step 'Add Solution': Property 'SiteUrl' contains an invalid URL

http://weblogs.asp.net/jan/archive/2010/05/07/sharepoint-2010-bdc-model-deployment-issue-the-default-web-application-could-not-be-determined.aspx

Create a new Business Data Connectivity Model project in Visual Studio 2010 and (optionally) implement all your code, change the model etc. When you try to deploy you get the error mentioned above.
To fix it, in the Solution Explorer, navigate to and open the Feature1.Template.xml file (the name could be different if you decided to give your feature a different name of course).




Add the following XML in the Feature element that’s already there (replace the Value with the URL of your site of course):



The resulting XML should look like:



Deploy the solution, now without any issues. :-)

Tuesday, August 3, 2010

Changing dd/mm/yyyy(UK english) to mm/dd/yyyy(US english) in sharepoint programatically

Take one label and one button (by default label will display the current date
if we click on the button it will show us format(mm/dd/yyyy)



string strdate = "";
string startdate = "";
SPWeb spWeb = new SPSite(SPContext.Current.Web.Url.ToString()).OpenWeb();
startdate = System.DateTime.Now.ToString();

Label1.Text = startdate;(To display current date)

//method to change date format dd/mm/yyyy to mm/dd/yyyy


public void GetDates(string date, out string Date)
{
Date = "";
string strYear = "";
string strMonth = "";
string strDay = "";


string[] Dates;
Dates = date.Split('/');
for (int i = 3; i <= Dates.Length; i--)
{
if (i > 0)
{
if (i == 2)
{
if (Dates.GetValue(i - 1).ToString().Length == 2)
{
strMonth = Dates.GetValue(i - 1).ToString();
}
else
{
strMonth = "0" + Dates.GetValue(i - 1).ToString();
}
}
if (i == 3)
{
strYear = Dates.GetValue(i - 1).ToString();
}
if (i == 1)
{
if (Dates.GetValue(i - 1).ToString().Length == 2)
{
strDay = Dates.GetValue(i - 1).ToString();
}
else
{
strDay = "0" + Dates.GetValue(i - 1).ToString();
}


}
}
if (i == 0)
{
Date = strMonth + "/" + strDay + "/" + strYear;
return;
}
}
}





protected void Button1_Click(object sender, EventArgs e)
{
// SPWeb spWeb = new SPSite("http://jagadeeshv:2222").OpenWeb();

if (spWeb.RegionalSettings.LocaleId != 1033)
{
GetDates(startdate, out strdate);
startdate = strdate;
Label1.Text = strdate;
}
else
{
Label1.Text = startdate;
}
}

Getting or finding Locale ID(Regional settings) programatically (Getting current culture ID) in sharepoint

spWeb.RegionalSettings.LocaleId=1033(for US english)

Content Editor Webpart not showing up in SharePoint Online ------------------------------------------------------------------------------...