Reputation: 39
Why do I get this error?
"Index (zero based) must be greater than or equal to zero and less than the size of the argument list."
for the following code?
string lookupSchema = "<Field Type='Lookup' DisplayName='{0}' Required='FALSE' EnforceUniqueValues='FALSE' List='{70d6098c-6ba0-4e9e-b101-a60b88fc226a}' ShowField='Title' UnlimitedLengthInDocumentLibrary='FALSE' RelationshipDeleteBehavior='None' StaticName='{0}' Name='{0}'/>";
string columnSchema = string.Format(lookupSchema.ToString(), listOfColumns[1]);
Upvotes: 1
Views: 1007
Reputation: 39
Thanks for you answers. As it turns out the problem was in the lookupSchema string due to curly braces. Just changed "List='{70d6098c-6ba0-4e9e-b101-a60b88fc226a}'" to "List='{{70d6098c-6ba0-4e9e-b101-a60b88fc226a}}'" and its working now.
Upvotes: 2