Loading...

Sunday, May 15, 2011

Understand the feelings of TFS which is integrated with Sharepoint Project in VS2010 :)

There are lot of enhancements tfs with visual studio 2010 over visual studio 2008.Lot of automatic things. But Some times we need to take care of.
For example,

1)When you move the files from rootfolder to mapped folder ,still the virtual instance of original file remains as it is for that you need to unload the project
Right Click-->unload the project  then again reload.

2)When you delete the Sharepoint Project Items, And you start packaging the solution ,compiler cries  'could not find the deleted file path'.

thus you need to edit the .feature file  and remove the guid projectitemreferance and package again.
you need to edit the .csproj file-->ctrl+f-->Find project referance guid as mentioned above.And remove the referance

If you know better way or best practices working with tfs integrated with sharepoint project please do the comments

Friday, April 15, 2011

Writing Code Behind for MenuItems defined in Custom Action

A)

When ever you want to  add the application page to Particular location in sharepoint site
Get the reference of this site
http://www.customware.net/repository/pages/viewpage.action?pageId=69173255
for example


To add code behind, You need to inherit  the class from MenuItemTemplate, and to Capture the Postback events inherit for Interface IPostBackEventHandler
public class MyListSiteActionMenu : MenuItemTemplate, IPostBackEventHandler
{
public MyListSiteActionMenu()
{
this.ID = "myOwnIdHura";
}

protected override void CreateChildControls()
{
this.Text = "Delete Item";
this.Description = "Deletes Item";
this.ClientDEFANGED_OnClickPostBackConfirmation = "Are you sure you want to delete this item?";
this.ClientDEFANGED_OnClickUsingPostBackEvent = this.ID;
}

public void RaisePostBackEvent(string eventArgument)
{
SPContext.Current.ListItem.Delete();
SPUtility.Redirect(SPContext.Current.List.DefaultViewUrl, SPRedirectFlags.Default, this.Context);
}
}

Some more links  adressing postbacks of  Menuitem template
http://www.dev4side.com/community/blog/2010/3/9/implement-postbacks-in-the-spmenufield-sharepoint's-control.aspx

B)Modifing the text of the MenuItem depending on  Custom List Property value
in 

Psedo Code as follows
CreateChildControl()
{
 //Code to display text of  menuitem depending on Custom List Property value
set the text of menuitem  according to property of list 
} 

RaisePostBackEvent(string eventargument)
{
//updated list Propery on menuitem click
list.rootfolder.Addproperty();
list.rootfolder.SetProperty() ;
} 





Tuesday, February 1, 2011

How to enable Powershell’s Integrated scripting environment for running Sharepoint 2010

Run following commands on powershell
Import-Module ServerManager; Add-WindowsFeature PowerShell-ISE
alternatively
Search for server manager and add this feature as follows


Configuring ISE for sharepoint
• Copy or type the following text in the Command Pane (View > Go to Command Pane) and press ENTER:


# Creates a local user PowerShell ISE profile

if (!(test-path $profile ))

{new-item -type file -path $profile -force}

# opens it for edit

psEdit $profile

• Running these commands will open a new script file in the Script Pane. Type the following commands in the script file and save it by clicking the Save button on the toolbar:

# Copy the following into the new file and save it

cd 'C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\14\CONFIG\POWERSHELL\Registration'

.\SharePoint.ps1

cd \

From now on, the SharePoint cmdlets will automatically load every time you start Windows PowerShell ISE as the same user. If you are still having problems using it, you may need to run it as an Administrator by right-clicking the shortcut and selecting Run as administrator (you can also force it to run as an administrator every time by right-clicking the shortcut, selecting Properties and then the Advanced button).

Tuesday, January 11, 2011

How to Create the Sharepoint 2010 Projects Where MOSS 2010 is not Installed?

Hello EveryOne,

        This article is just for knowledge sake and  to know about managing on machine where sharepoint 2010 is not installed.
If you have installed VS2010(visual studio ultimate) ,& Navigated as  Start ->VS2010 ->Run as administrator->New Project->Sharepoint 2010. You will get the popup that you can not create the sharepoint projects as MOSS 2010 is not installed.


But dont fear,If there is Will , there is Way :-)
Follow me as follows
1)Start -->Run-->RegEdit-->Select HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Shared Tools\Web Server Extensions\14.0

and Export the file
and Import on  machine where SP2010 is not installed.
2)Now you wont get the popup but it will ask for the url in Wizard.
still go ahead. and put the IP address of the remote server or any dummy url.
and dont click on validate url  and click on finish

3)With this settings you can just  create the wsp but once you click on the Deploy the project
then again You have to face the same error that 'Sharepoint is not installed on local machine'

4)You can put your commands in a PowerShell script (.ps1) file and pass the path of the script file to PowerShell.exe.  Then you can just put this command in your post build event to run your PowerShell script after you compile

5)This will hold the command which will be executing on the remote machine where Sharepoint 2010 is installed.
to enable the remote execution of powershell commands follow the steps as given in this blog

6)If you get 'Access Denied error' while execution of PS commands, then check if Active directory domain services is enabled on Target machine


Thursday, January 6, 2011

How to Import CSV files to Term Store in Sharepoint 2010

1)Go to the term strore as directed in following Image


Click on view sample Import file  and Import it back.
This will generate the terms for tagging
Next I will demonstrate  how to use tagging..

2)Create the list with column of Type Managed Metadata as directed as following Image
3)When List is created and You add/update new items this column will have the ability to Select values from term store


Monday, December 6, 2010

Different Security Issues that can be raised with SharePoint Site

1)Cross site request Forgery

2)Client Side Cookies refernces

3)Missing secure attribute  in encrypted  SSL Cookies

and some more

I will elaborate it soon..keep reading ..