Take the 2-minute tour ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

I am using the object model to loop through the items in the built in "Task" list. For some reason when I get the value for the "Title" field for each item it returns values like 1_.000, 2_.000 etc. instead of returning the title that is displayed by the default view.

Do I need to do something special to get the actual title rather than these strange values?

P.S. I checked which columns are being displayed in the default view and there are three versions of Title in there: "Title", "Title (linked to item with edit menu)" and "Title (linked to item) ". I tried using each one but still get the weird values.

share|improve this question
1  
Can you list the code? Does it behave the same against other list types? –  SHug May 3 '11 at 15:25
    
It just happens for the Task list. I will post some code up later today. –  Abe Miessler May 3 '11 at 17:26
    
This isn't in a meeting workspace, is it? –  James Love May 3 '11 at 18:31
    
Your days are looong... ;) –  Stuart Pegg May 25 '11 at 18:03
    
did you ever find the answer to your question? –  Kit Menke Jun 16 '11 at 16:53
add comment

2 Answers

up vote 0 down vote accepted

Are you using SPListItem.Title?

You might want to just try:

SPListItem item; // get the item from somewhere
string title = item["Title"].ToString();
share|improve this answer
    
No i'm not using SPLIstItem.Title. I am using the method you suggested. –  Abe Miessler May 3 '11 at 17:26
    
We need your code! :) Just tried on my Tasks list, and I'm getting right title value from both item.Title and item["Title"].ToString() –  Andrey Markeev May 3 '11 at 17:36
add comment

I just tested this with a OOB Task list and it worked fine with the code below.

public static void TestOneFuncOne()
{
    using (SPSite site = new SPSite("http://siteurl"))
    {
        using (SPWeb web = site.OpenWeb())
        {
            SPList list = web.Lists["Tasks"];
            SPListItemCollection items = list.Items;
            foreach (SPItem item in items)
            {
                String title = item["Title"].ToString();
            }
        }
    }
}

Have you read about how SharePoint the reference to version URL SPListItemVersion.Url Property?

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.