I am trying to develop a wind开发者_如何学编程ows application using C# and SharePoint built in web services, that add\update files to SharePoint document libraries.
Now i am creating a form that fill the item fields.Is there a way to know each field type and his specific control?
ex: single text field is text box, Choice field is a combobox...and what if i have a lookup field or people picker?
You can get the field type by reading the "Type" attribute from each field element that comes back in the List xml node, it will come back "Text", "Number", etc.
However, there is no way to know how each field type will be rendered in the SharePoint UI. Since there is only a limited number of field types, you can always create every type of field, check how SharePoint renders them on the web, and just replicate the behavior in your WinForms application.
If it was a web app I would use the ListFieldIterator see here for an example however as youre working with winforms I reckon youre going to have to go with Steve's suggestion.
As a last resort you could pull a simple web form from the server (which renders the listfielditerator) in a web viewer control - assuming you pass the web, list and listitem id in as parameters.
精彩评论