Gunnar Peipman's ASP.NET blog

ASP.NET, C#, SharePoint, SQL Server and general software development topics.

Sponsors

News

 
 
 
 
 
Programming Blogs - Blog Catalog Blog Directory
 
 
 

Links

Social

SharePoint problem: moderation comment is not saved

I solved last week one pretty cool mystery in SharePoint. I have form that users use to make some specific changes to list items. When all the fields on form are filled then user clicks save button. Changes are saved to list item and list item is automatically accepted. Status change is made through ModerationInformation property of SPListItem. Everything seemed to work except one little thing – moderation status comment was not saved.

It took me couple of hours to figure out what is going on. This time, again, Reflector saved my ass. I followed the method calls from list item update to SPRequest methods (find out more by reading brilliant code posting Understanding SharePoint: SPRequest by Hristo Pavlov) that Reflector wasn’t able to disassemble. As soon as I saw request I got the correct answer: Response.

Take a look at this code fragment.


// initialization code

 

item.ModerationInformation.Status = SPModerationStatusType.Approved;

item.ModerationInformation.Comment = "Accepted";

item.Update();

 

// some more code

 

Response.Redirect(returnUrl, true);


You see that Response is forced to end using second argument of Response.Redirect() method. This was the source of problem. After using Response.Redirect with one argument the problem was solved because Response was not forced to end.

I hope this information saves some hours of work for world. :)


kick it on DotNetKicks.com pimp it Progg it 顶 Shout it
vote it on WebDevVote.com
Posted: Aug 10 2009, 01:23 PM by DigiMortal | with 7 comment(s)
Filed under:

Comments

DotNetShoutout said:

Thank you for submitting this cool story - Trackback from DotNetShoutout

# August 10, 2009 6:29 AM

DotNetBurner - ASP.net said:

DotNetBurner - burning hot .net content

# August 10, 2009 6:30 AM

PimpThisBlog.com said:

Thank you for submitting this cool story - Trackback from PimpThisBlog.com

# August 10, 2009 6:31 AM

DotNetKicks.com said:

You've been kicked (a good thing) - Trackback from DotNetKicks.com

# August 10, 2009 6:35 AM

progg.ru said:

Thank you for submitting this cool story - Trackback from progg.ru

# August 10, 2009 6:36 AM

9eFish said:

9efish.感谢你的文章 - Trackback from 9eFish

# August 10, 2009 6:37 AM

WebDevVote.com said:

You are voted (great) - Trackback from WebDevVote.com

# August 10, 2009 6:38 AM
Leave a Comment

(required) 

(required) 

(optional)

(required)