Posts

Showing posts with the label SPservices

SharePoint: Redirection to a desired page after adding a New item to a list

Image
Context  One of the requirements that we frequently come across setting a return address of the NewForm.aspx page. That precisely means that if you are about to add a new item to a list, first you press the link "Add New Item" (or some other way) and a newform.aspx appears as a pop up. Upon filling the required fields and pressing Save you are redirected to the same list (All item view.) The problem arises if we don't to be redirected to this view rather to some other page. For that reason here is the trick. Solution:  The URL to newform.aspx consists of two query strings i.e. "RootFolder" and "Source". Let leave Rootfolder for now and focus "Source" Setting the Source with your desired URL will redirect the user to this specific desired page that has been point in the Source. Remember that source requires a URL encoding. you can encode your URL using the following link http://www.url-encode-decode.com/ . So what I did is to place an an...

SharePoint 2010/2007: Setting value of "Person or Group" Column Using SPService

Image
Context: Well I had a list called employees comprising of  two columns: i.e. Title (Single line of text) and  a Person or Group type column that is to be filled with the user. I was trying to fill this column with the current user. Solution  So here is the code that will aid in achieving just that. Click Me! There are number of aspect in this code that need to be addressed. First this is the format of the string that fill s the person or group type column. In normal cases, the item in Person or Group type column shows up in the following format: ID;#Domain\UserName. Here what I used: "-1;#"+loggedinUser So it means you don't need to find ID to form the aforementioned string, rather direct concatinating -1 to the username can do the magic. If somebody is totally unaware about how to use this code, I used content query webpart (out of the box webpart) to write this code. Update: well later I tried to make use of the same technique in the server side ...