Messed up Smart Object keys causing 'key does not exist' exception
I'm uisng a Smart Object to get a list of items from a SharePoint list. To set up the smart object I deleted all the methods, added a GetList method, linked it to the SharePoint list, and then 'auto-created' the smart object properties. This works fine.
Here's the problem. One of the properties is called (for example) “Manager Name”. I should be able to use the following:
So.Properties[“Manager Name”].Value.ToString()
But this throws a ‘Key does not exist in the collection’ exception. However, if I type
So.Properties[0].Value.ToString()
It works perfectly. I stepped in with the debugger and found out that if I type
So.Properties[“Title”].Value.ToString()
I get the value for the Manager Name! The other properties also have messed up keys. If I look at the smart object in VS I see 'Manager Name' and NOT 'Title'. None of the properties are SmartBox properties.
I've now had to resort to using integers to access the properties of my Smart Object which is now inconsistent for the rest of my smart objects, all of which work perfectly with keys.
Anyone else seen this? Any workarounds? I'm using SP1.
Thanks in advance!
Here's the problem. One of the properties is called (for example) “Manager Name”. I should be able to use the following:
So.Properties[“Manager Name”].Value.ToString()
But this throws a ‘Key does not exist in the collection’ exception. However, if I type
So.Properties[0].Value.ToString()
It works perfectly. I stepped in with the debugger and found out that if I type
So.Properties[“Title”].Value.ToString()
I get the value for the Manager Name! The other properties also have messed up keys. If I look at the smart object in VS I see 'Manager Name' and NOT 'Title'. None of the properties are SmartBox properties.
I've now had to resort to using integers to access the properties of my Smart Object which is now inconsistent for the rest of my smart objects, all of which work perfectly with keys.
Anyone else seen this? Any workarounds? I'm using SP1.
Thanks in advance!
Enter your E-mail address. We'll send you an e-mail with instructions to reset your password.