R – Weird SPListItem URL when adding a new announcement

sharepoint

When I add a new item in a default Announcement list using the GUI the new item looks just as I would expect, showing the title of the item in the breadcrumb. However when adding the new item through the object model:

SPList theList = web.Lists["announcement"];

SPListItem theitem = theList.Add();

theitem["Title"] = "this is the title";

theitem.Update();

then the breadcrumb will display something like
WebTitle.ListTitle.34_.000, which I believe to be the itemID and versionnumber of the item.

A search give this but I would like to know the root cause and possible how to avoid the issue.

Best Answer

The issue has been resolved. Actually the list in question was a discussion list, not a announcement list ( why it was then named "announcement" is a big mystery), Since a discussion is actually a thread container and the threads within the container, I had to call SPUtility.CreateNewDiscussion rather then list.Add.

Related Topic