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 have a custom SharePoint 2007 document library which has a custom boolean column "Is it Important".

It works perfectly for all documents if I upload documents one by one regardless of if its a word file or a picture file ".png or .jpg" as I can see property and can even access it through code.

Now if I upload files simultaneously using "multiple files upload" all documents except files with extension .png or .jpg get property "Is it Important". Now I can get value of property but if I try to check if it exists it returns false, wondering if anyone knows what could be the reason.

This is how I am checking custom property,

item.Properties.ContainsKey("Is it Important");

and getting value as

item["Is it Important"]
share|improve this question
add comment

1 Answer

up vote 1 down vote accepted

As stated problem was with

 item.Properties.ContainsKey("Is it Important");

I couldn't find out what caused this weird behaviour but I find a work around which is going through each SPField and check if my field exists or not using title.

private bool IsFieldThere(string ColumnName, SPListItem item)
{
    SPFieldCollection fieldCollection = item.Fields;

    foreach (SPField field in fieldCollection)
    {
        if (field.Title == ColumnName)
        {
            return true;
        }
    }

    return false;
}

I used title as I know it will change but you can use internal name to be on safe side.

Hope it helps.

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.