kamagra how much to take

Using FileSystemObjectType.Folder and UnderlyingObjectType in ECMAScript (Client Object Model)

ECMAScript is sorta hit or miss in regards to utility IMHO but I having been involved in a few internal MSFT projects about it so have been using it more and more. Two assets that are significant when working with ECMAScript, specifically item creation, are the FileSystemObjectType enumeration and SP.ListItemCreationInformation.underlyingObjectType property. The FileSystemObjectType enumeration contains the following values:

invalid – the object is invalid.
file – the object is a file.
folder – the object is a folder.
web – the object is a site.

Using these values, you can use the SP.ListItemCreationInformation.underlyingObjectType property to toggle your item creation type, as demonstrated in the below code snippet:

  1. var clientContext = new ClientContext("http://localhost/");
  2. var web = clientContext.get_web();
  3. var listCollection = web.get_lists();
  4. var list = listCollection.getByTitle("TestList");
  5. var itemCreateInfo = new ListItemCreationInformation();
  6. itemCreateInfo.set_underlyingObjectType(SP.FileSystemObjectType.folder);
  7. var listItem= list.addItem(itemCreateInfo);
  8. // Set title and properties
  9. listItem.Update();
  10. // context.Load(web);
  11. // context.Load(list);
  12. clientContext.ExecuteQuery();
Share

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>