[ANN] InDesign CC 2014 Document Object Model Documentation

I've freshly rendered an alternative documentation for Adobe ExtendScript API and the InDesign Object Model.
InDesign ExtendScript API (10.0)
I don't like the representation in the Object Model Viewer provided by the Adobe ExtendScript Toolkit and hence used the HTML Version from Jongware on a daily basis. However these files are only up to InDesign CS6 and not searchable. So I started to convert them on my own. If you feel familiar with the structure and layout from Jongware files, this is not by chance, because I'm totally used to it.
Feel free to browse the documentation, download a copy for offline usage (Unfortunately the offline search function will not work in Chrome). The sources of the Transformation can be found on github. The copyright of the original Files is by Adobe Systems Incorporated.
I'm happy about Feedback and Bug reports. Keep in mind that the doucmentation sources are written by Adobe and I can only corret transformation errors!
Acknowledgements
This project ist based on the fantastic ExtendScript API HTML from [Jongware]. Without his efforts and inspiration I would not have realized it. Thank You!

Hello Jongware!
After a couple of changes for ID CC2014 as you'll note below (" -> ', and, Object Styles) to an old couple lines of your code, I got the following to work beautifully to delete all the unused Indesign styles in a document off a hot key. A real time saver!
//DeleteAllUnusedStyles
app.menus.item('Paragraph Style Panel Menu').menuItems.item('Select All Unused').associatedMenuAction.invoke();
app.menus.item('Paragraph Style Panel Menu').menuItems.item('Delete Styles…').associatedMenuAction.invoke();
app.menus.item('Character Style Panel Menu').menuItems.item('Select All Unused').associatedMenuAction.invoke();
app.menus.item('Character Style Panel Menu').menuItems.item('Delete Styles…').associatedMenuAction.invoke();
app.menus.item('Object Styles Panel Menu').menuItems.item('Select All Unused').associatedMenuAction.invoke();
app.menus.item('Object Styles Panel Menu').menuItems.item('Delete Styles…').associatedMenuAction.invoke();
The only thing stopping me from popping it into a loop to do a whole book at once (a trick I got from your excellent show-hide layers script) is that I don't know how to "Check The Box" in the ID UI that opens as it does each panel to make it "Apply To All". I'm sure it's quite simple but I've been through your handy dandy Script classes list, and ExtendScript, 'til I'm blue in the face and can't take it any more.
Can you offer me a hint where to look?
Best Regards,
HP

Similar Messages

  • Documentation for the Acrobat Document Object Model

    Hello
    I'm trying to move my first steps in this field, I hope you can bear with my naive questions.
    I'm trying to find the documentation for the Acrobat Document Object Model. To my surprise a search in the forum's archives was unsuccessful.
    I remember downloading out of curiosity a few PDFs from Adobe about their implementation of JavaScript in Acrobat, one precisely concerning ADOM (but I could be wrong as it was a few years ago and I'm getting old): are those documents a thing of the past?
    Thank you very much.
    Giordano

    Have a look here:
    http://www.adobe.com/devnet/acrobat/javascript.html
    The link there is for the version 9 reference, which is usually good enough,
    but if you want the latest one (in PDF form), you can find it inside the
    Acrobat X SDK package, here:
    http://www.adobe.com/devnet/acrobat/sdk/eula.html

  • [svn:osmf:] 10134: Improvements to the VAST document object model.

    Revision: 10134
    Author:   [email protected]
    Date:     2009-09-10 15:08:05 -0700 (Thu, 10 Sep 2009)
    Log Message:
    Improvements to the VAST document object model.
    Modified Paths:
        osmf/branches/briggs-prototype/libs/VAST/.flexLibProperties
        osmf/branches/briggs-prototype/libs/VAST/org/openvideoplayer/vast/loader/VASTLoadedContex t.as
        osmf/branches/briggs-prototype/libs/VAST/org/openvideoplayer/vast/loader/VASTLoader.as
        osmf/branches/briggs-prototype/libs/VAST/org/openvideoplayer/vast/media/VASTMediaGenerato r.as
        osmf/branches/briggs-prototype/libs/VAST/org/openvideoplayer/vast/model/VASTAd.as
        osmf/branches/briggs-prototype/libs/VAST/org/openvideoplayer/vast/model/VASTAdInline.as
        osmf/branches/briggs-prototype/libs/VAST/org/openvideoplayer/vast/model/VASTVideoClick.as
        osmf/branches/briggs-prototype/libs/VAST/org/openvideoplayer/vast/parser/VASTParser.as
        osmf/branches/briggs-prototype/plugins/MASTPlugin/org/openvideoplayer/mast/dom/MASTDocume ntProcessor.as
        osmf/branches/briggs-prototype/plugins/MASTPlugin/org/openvideoplayer/mast/media/MASTLoad er.as

    Hello,
    This issue is currently being addressed and will be solved very soon.  Once the OMSF team has a chance to review the patch they will place it in the OSMF repository.  This was a known issue but not addressed because VAST 1 is deprecated by the IAB and we spent our efforts working on the VAST 2 implementation.  However, I understand that a few publishers will need VAST 1 clickthrus because advertisers are still moving away from that standard and clickthurs is an important part of the standard. I will update you when the fix is ready on the repository.
    Regards,
    Craig
    Eyewonder

  • How to save an Adobe InDesign CC 2014 document with AppleScript

    Code that works in CS4 and CC is broken in CC 2014. Anyone have a work around for this?
    tell application "Adobe InDesign CC 2014"
      tell document 1
      save
      end tell
      -- error "Adobe InDesign CC 2014 got an error: User canceled this action." number -128
    end tell

    Is document 1 a new document or has it already been saved somewhere?
    If you are trying to save a newly created document you have to provide a path:
    tell application "Adobe InDesign CC 2014"
      tell document 1
      save to alias "HD:Users:username:Desktop:myfile.indd"
      end tell
    end tell

  • Is there an Object Model documented somewhere?

    I'm trying to fit this all together, and the various pieces seem to be described either in highly fragmented text, or the overwhelming LiveDocs. And I don't typically find the fragments in LiveDocs.
    Right now I'm trying to figure out how to get from a Spark TextArea to a collection of TextLines. I imagine there are a bunch of abstraction layers between. How best do I figure out what they are?

    A Spark TextArea has a content, which is (or can be) a TextFlow. You can get this from the TextArea.textFlow property as a TextFlow. A TextFlow has a IFlowComposer, and the flow composer has a controller. The controller has the container, and the container is the parent of the TextLines.Alternatively, if you want access to lines that may be scrolled off. you can get to a TextFlowLines in the flow composer (see for instance IFlowComposer.getLineAt). If the line is not visible, there may not be a corresponding TextLine in the TextFlowLine, but you can get one by calling getTextLine(true) on the TextFlowLine.
    The class headers in the API docs have overview descriptions of some of this, and there is also "Overview of the Text Layout Framework" in the API docs that has a description of the various packages. I hope this gets you started!
    - robin

  • Is latest version of safari supports Doccument Object Model?

    Hi All,
    I wish to know that the latest version of Safari browser supports DOM (Doccument Object Model)?.
    There is any VC++ sample code for doing the DOM in safari?.
    Please help.
    Thanks,
    R-VR

    Hi All,
    I didn't get any reply from anyone.
    I wish to implement Document Object Model with MicroSoft Active Accessibility for Safari Browser.
    It's a part of my project. So, anyone please send me some vc++ sample code.
    Hope your help.
    Thanks,
    R-VR

  • Document Object

    Hi,
    I have one addon in which i am using document object model in this add on document no text box should de non editable field after clicking find only it should editable. how to give this property.

    Hi dns_sap,
    Catch the ItemPressed event when pVal.ItemUID = "1" and pVal.BeforeAction = False and pVal.ActionSucess = True and load the next DocNumber
    With oForm.DataSources.DBDataSources.Item("@DOC_TABLE")
         .SetValue("DocNum", .Offset, oForm.BusinessObject.GetNextSerialNumber(oForm.Items.Item("Series").Specific.Selected.Value.ToString).ToString)
    End With
    Note: oForm.Items.Item("Series") is the Series ComboBox.
    Regards,
    Vítor Vieira

  • Does Java have an object model for the actual .java files?

    OK, you know how you can use the Document Object Model (DOM) in JavaScript or PHP to access and modify specific parts of an HTML document? Is there anything similar for .java files? Can I load a .java file into some kind of Java Code Object Model (JCOM?) and then manipulate that code as if it were an object.
    Note: I am not asking how to instantiate and use a regular object as defined by the .java file. I am wondering about modifying the actual .java file itself as an object that represents the actual text of the code in the .java file.

    GrantSR wrote:
    Not the code, per se, but the classes they define... Yessum, most certainly: ASM, among others.
    Also Google [java parser|http://www.google.com.au/search?q=java+parser]... one of them might do what you're after.
    So, one would parse the Java code into XML using one of these many and
    varied parsers, then access that XML via the DOM? Well, I guess a two
    step process is good enough.
    Thanks for your help.
    No wuckers!
    But I don't know if I did much. If you do get something working please post back, and outline your approach.
    Cheers. Keith.

  • Is there a trick to copying objects from InDesign CC to CC 2014 documents?

    When I attempt to do this, the objects pasted to the InDesign 2014 document are not directly editable; they seem to have become some sort of lowres, uneditable item - whether they were originally text objects or graphic objects.
    Further, if I paste two objects at once, they are combined into one such uneditable item. The same thing happens if I attempt to go the opposite direction and paste objects from 2014 into CC.
    Thanks, for your help!

    I like to expand my suggestion for working with InDesign library files. One library created in InDesign CC, one library created in CC 2014. As already mentioned, you can have both libraries open in both versions. Drag and drop the objects you want to copy/paste to the appropriate library and drag them out to your page in whatever InDesign version you currently working:
    The little lock icon at the bottom of the library will indicate that you cannot add items. But you can use the assets stored in the library.
    Left: InDesign CC
    Right: InDesign CC 2014
    Of course opening a CC file in CC 2014 is possible and copy/paste from that. But you cannot open a CC 2014 file in CC. You first have to save a IDML file and open that in CC. Working with two libraries will be easier when you permanently like to exchange assets in both directions.
    Uwe

  • Indesign Scripting Object Model

    Hi,
    Is there some reference documentation that provides detailed information on the Indesign object model as exposed to the scripting interface (javascript)?
    I have done fair amount of scripting in Illustrator so I was looking for the Indesign equivalent of this document
    http://wwwimages.adobe.com/www.adobe.com/content/dam/Adobe/en/devnet/pdf/illustrator/scrip ting/illustrator_scripting_reference_javascript_cs5.pdf
    I looked at this document but it seems kind of sparse (compared to illustrator)
    http://wwwimages.adobe.com/www.adobe.com/content/dam/Adobe/en/products/indesign/pdfs/InDes ignCS5_ScriptingGuide_JS.pdf
    Obviously they are different applications but I was kind of hoping there would be more info for Indesign scripting.
    In particular I am looking for some insight on how to effectively walk or traverse the document structure of an indesign document using code.
    Finding specific things by type seems out of the picture becuase after doing object reflection on all the page items in an indesign document nothing seems to have a "type" property.
    In my illustrator scripts I was able to place stuff in illustrator layers, give arbitrary pageitems a name and then later go find and manipulate via script. Not as clear how to do this in an indesign context.
    The one advantage of this was that in illustrator I was able to use textframes to hold variable data and read later via scripts. The document becomes the database. And I could create any number of arbitrary "variables" inside the document outside the white board. WOndering how to do this kind of stuff with indesign so I can do template driven documents that are managed by scriptings and form UI that I create.

    commnet: Glad to hear you're clear on the new keyword. It's something that a lot of people are confused about.
    Also glad to hear you've read Crockford's book on this stuff. Honestly I think for most InDesign usage, it's a mistake to worry about any kind of inheritance...usually it's easier to ignore all that stuff.
    And to answer the question about number of properties, probably talking max 100 or so. Certainly not thousands. I just want to have my own datastructure embedded in the indesign document that I can easily talk to via scripts. And this data needs to persist between instances of the javascript script's lifecycle. So it seems having some XML to parse is the solution. If that makes sense.
    If there was a way to deal with JSON data "hidden" within an indesign document I would gladly work with that. But I still need to change certain common content snippets inside the flow of the indesign document in a consistent way.
    I think if you have max 100 properties, you should probably choose the methods that are clearest code, rather than most efficient. I suppose you might have noticable delay with 100, though, obviously try it and see. I'm confused but I thought you needed to have your data associated with text elements inside your document, such that it is visible to a user in the user interface. Hence the proposal of using XML tagged text inside a Text Frame. Did that requirement go away?
    If you just want to hide JSON in the document, then use document.insertLabel() of a string of JSON and be done with it.
    You can also use the JavaScript interpreter's E4X features, that give you much richer Javascript bindings for manipulating XML objects and files. Unfortunately the Javascript's XML bindings have nothing to do with the InDesign XML object model. So could, e.g., export the InDesign DOM XML into a file, read that into a Javascript XML object, manipulating with E4X functions, write it out to a file, and then re-import it into the DOM. Not really very convenient.
    I honestly don't know much about Javascript for browsers, so if you could be more concrete in your queries it would be easier to answer.
    Looking forward to your example snippet though.
    OK, so, in Jeff (absqua)'s example, you create a constructor for a changeNumber rule, you call the constructor to make a rule, add the rule to the ruleset, and change a value attribute of the rule, and then process the ruleset.
    This strikes me as...extremely goofy. For two reasons, first the ruleset creation function should be parametrized with the value you want to change, and second, that you go change the rule's attributes after you have added it to a ruleset. Also, while this works in this example, I don't think it's appropriate to have the xpath attribute hardcoded in the rule creation function -- it's much plausible that you want a function that constructs a rule that changes some arbitrary tag to some arbitrary value.
    So, anyhow, if you were going to stick with the constructor paradigm, then I would change from:
    var changeNumber = new ChangeDocumentNumber();
    var ruleSet = [changeNumber, changeDescription];
    changeNumber.value = "5678";
    __processRuleSet(doc.xmlElements[0], ruleSet);
    to:
    var changeNumber = new ChangeDocumentNumber();
    changeNumber.value = "5678";
    var ruleSet = [changeNumber, changeDescription];
    __processRuleSet(doc.xmlElements[0], ruleSet);
    But I don't like this, because it's not parametrized reasonably. I would want something like:
    var changeNumber = new ChangeValue("//DocumentNumber", "5678");
    var changeDescription = new ChangeValue("//DocumentDescription", "New descr.");
    var ruleSet = [ changeNumber, changeDescription ];
    But because of my disdain for classical inheritance in JavaScript, I would instead write it as:
    function changeValue(xpath, newValue){
      return {
        name: "ChangeValue",
        xpath: xpath,
        apply: function(Element, processor) {
          if (newValue) {
            element.contents = newValue;
          return true;
    var changeNumber = changeValue("//DocumentNumber", "5678");
    var changeDescription = changeValue("//DocumentDescription", "New descr.");
    Because I think that a lot clearer about what is going on without introducing confusion.
    Edit: removed "this.value" from the above and just used newValue directly.
    But if you're defining a lot of rules with different apply functions, this is a very cumbersome strategy. You have all this boilerplate for each function that is basically the same but the apply function is different. This is leads to a lot of wasted code duplications. Why would your apply function be different? Well, that would usually be if you are writing functions that move around XML elements within the document hierarchy, or other things that are not simply changing the value of an element.
    I would much prefer to write this as:
    var changeRule = makeRule("change",
      function(element, ruleProcessor, newValue) {
        element.contents = newValue;
    var changeNumber = changeRule("//DocumentNumber", "5678");
    var changeDescription = changeRule("//DocumentDescription", "New descr.");
    var ruleSet = [ changeNumber, changeDescription ];
    This kind of syntax makes it much more compact to create arbitrary rules with different apply functions. In retrospect, the makeRule() function is named wrong, because it returns a function that makes a rule. Perhaps it'd be more reasonable if it was called makeRuleMaker().
    Anyhow, the downside is that the makeRule() function is kind of heinous. I wrote this in March in Re: How to shift content with in cell in xml rules table. But:
    //// XML rule functions
    // Adobe's sample for how to define these is HORRIBLE.
    // Let's fix several of these problems.
    // First, a handy object to make clearer the return values
    // of XML rules:
    var XMLmm = { stopProcessing: true, continueProcessing: false};
    // Adobe suggest defining rules constructors like this:
    //   function RuleName() {
    //       this.name = "RuleNameAsString";
    //       this.xpath = "ValidXPathSpecifier";
    //       this.apply = function (element, ruleSet, ruleProcessor){
    //       //Do something here.
    //       //Return true to stop further processing of the XML element
    //       return true;
    //       }; // end of Apply function
    // And then creating a ruleset like this:
    //   var myRuleSet = new Array (new RuleName, new anotherRuleName);
    // That syntax is ugly and, and is especially bad if
    // you need to parametrize the rule parameters, which is the only
    // reasonable approach to writing reasonable rules. Such as:
    //   function addNode(xpath, parent, tag) {
    //       this.name = "addNode";
    //       this.xpath = xpath;
    //       this.apply = function (element, ruleProcessor) {
    //           parent.xmlElements.add(tag);
    //           return XMLmm.stopProcessing;
    // and then creating a ruleset like:
    //   rule = new Array (new addNode("//p", someTag));
    // So instead we introduce a makeRule function, that
    // allows us to leave behind all the crud. So then we can write:
    // addNode = makeRule("addNode",
    // function(element, ruleProcessor, parent, tag) {
    //     parent.xmlElements.add(tag);
    //     return XMLmm.stopProcessing;
    // and use:
    // rule = [ addNode("//p", someTag ];
    function makeRule(name, f) {
        return function(xpath) {
            var
                //xpath=arguments[0],
                   // "arguments" isn't a real array, but we can use
                   // Array.prototype.slice on it instead...
                   args=Array.prototype.slice.apply(arguments, [1]);
            return {
                name: name,
                xpath: xpath,
                apply: function(element, ruleProcessor) {
                        // Slice is necessary to make a copy so we don't
                        // affect future calls.
                    var moreargs = args.slice(0);
                    moreargs.splice(0, 0, element, ruleProcessor);
                    return f.apply(f,moreargs);

  • HELP! Where I can find the InDesign Object Model, Methods, and Properties?

    I've done a little VB scripting with InDesign, using some of the examples I've found here and there. But I can't for the life of me find a full listing of the Object Model, nor a listing of methods and properties. I'm limited in what I can do by stumbling upon objects here and there in others' scripts. Surely this must be documented somewhere.
    One thing that's particularly confusing to me (partly because I'm not well-versed in JS), is I'll see something the following
    app.selection[0].fit(FitOptions.frameToContent)
    where "FitOptions.frameToContent" seems to reference a constant, presumably in a structure. How do I determine the actual constant value, or supply an object reference (as I'm scripting from a stand-alone VB app) such that it can "find" that constant?

    I don't know how VB5 works, but when you add reference to InDesign and declare variable, for example:
    Dim myInDi as InDesign.Application
    then when you write somewhere "myInDi." - VB6 IDE give you context list with all methods and properties of InDesign application
    here is link to AS/JS/VB CS2 reference and AS CS3 reference
    http://www.indesignscriptingreference.com/
    here is link to CS2 ScriptingGuide - 20MB ;)
    http://www.adobe.com/products/indesign/pdfs/InDesign_Scripting_Reference.pdf
    I remember that was page with InDesign Scripting PDFs on adobe site - but now all links are broken ... somebody in Adobe - web admin - should check what is going on ...
    Photoshop and Illustrator pages works fine:
    http://www.adobe.com/devnet/photoshop/scripting/
    http://www.adobe.com/devnet/illustrator/scripting/
    somebody forgot to add links to scripting section in InDesign page:
    http://www.adobe.com/devnet/indesign/
    robin
    www.adobescripts.com

  • How to create a Document Set in SharePoint 2013 using JavaScript Client Side Object Model (JSOM)?

    Hi,
    The requirement is to create ""Document Sets in Bulk" using JSOM. I am using the following posts:-
    http://blogs.msdn.com/b/mittals/archive/2013/04/03/how-to-create-a-document-set-in-sharepoint-2013-using-javascript-client-side-object-model-jsom.aspx
    http://social.msdn.microsoft.com/Forums/sharepoint/en-US/1904cddb-850c-4425-8205-998bfaad07d7/create-document-set-using-ecma-script
    But, when I am executing the code, I am getting error "Cannot read property 'DocumentSet' of undefined "..Please find
    below my code. I am using Content editor web part and attached my JS file with that :-
    <div>
    <label>Enter the DocumentSet Name <input type="text" id="txtGetDocumentSetName" name="DocumentSetname"/> </label> </br>
    <input type="button" id="btncreate" name="bcreateDocumentSet" value="Create Document Set" onclick="javascript:CreateDocumentSet()"/>
    </div>
    <script type="text/javascript" src="//ajax.aspnetcdn.com/ajax/jQuery/jquery-1.7.2.min.js"> </script>
    <script type="text/javascript">
       SP.SOD.executeFunc('sp.js','SP.ClientContext','SP.DocumentSet','SP.DocumentManagement.js',CreateDocumentSet);
    // This function is called on click of the “Create Document Set” button. 
    var ctx;
    var parentFolder;
    var newDocSetName;
    var docsetContentType;
    function CreateDocumentSet() {
        alert("In ClientContext");
        var ctx = SP.ClientContext.get_current(); 
        newDocSetName = $('#txtGetDocumentSetName').val(); 
        var docSetContentTypeID = "0x0120D520";
        alert("docSetContentTypeID:=" + docSetContentTypeID);
        var web = ctx.get_web(); 
        var list = web.get_lists().getByTitle('Current Documents'); 
        ctx.load(list);
        alert("List Loaded !!");
        parentFolder = list.get_rootFolder(); 
        ctx.load(parentFolder);
        docsetContentType = web.get_contentTypes().getById(docSetContentTypeID); 
        ctx.load(docsetContentType);
        alert("docsetContentType Loaded !!");
        ctx.executeQueryAsync(onRequestSuccess, onRequestFail);
    function onRequestSuccess() {       
        alert("In Success");
        SP.DocumentSet.DocumentSet.create(ctx, parentFolder, newDocSetName, docsetContentType.get_id());
        alert('Document Set creation successful');
    // This function runs if the executeQueryAsync call fails.
    function onRequestFail(sender, args) {
        alert("Document Set creation failed" + + args.get_message());
    Please help !!
    Vipul Jain

    Hello,
    I have already tried your solution, however in that case I get the error - "UncaughtSys.ArgumentNullException: Sys.ArgumentNullException:
    Value cannot be null.Parameter name: context"...
    Also, I tried removing SP.SOD.executeFunc
    from my code, but no success :(
    Kindly suggest !!!
    Vipul Jain

  • InDesign Object Model Not in OM Viewer

    I have the trial of InDesign CS4 installed, along with the scripting componetns and Adobe bridge.
    In the ES Toolkit object model viewer I have four options in the dropdown:
    Core JavaScript Classes
    ScriptUI Classes
    Adobe Bridge CS4 Object Model
    Adobe InDesign CS4 Object Model
    The first three options work fine. The crucial fourth option (the InDesign model) does nothing. I open it and the drop down just closes, then snaps back to whatever the previous selection was.
    What is causing this and how do I fix it? Hard to script without the object model reference!
    Many thanks in advance for any help.
    Jude Fisher
    http://www.jcfx.eu

    Try selecting InDesign from the drop down before starting InDesign.
    That's the only way I can get it to work on my installation...
    Harbs
    http://www.in-tools.com

  • Rename a File in a SharePoint document library through Client object model

    Hi,
    How  to Rename a File in a SharePoint document library through Client object model?
    Thanks
    Poomani Sankaran

    Hi,
    According to your description, you want to rename file in the document library using SharePoint Client Object Model.
    Here is a code snippet works well in my environment for your reference:
    static void Main(string[] args)
    string url = "http://sp2013sps/sites/test/";
    ClientContext clientContext = new ClientContext(url);
    Microsoft.SharePoint.Client.List spList = clientContext.Web.Lists.GetByTitle("Documents");
    clientContext.Load(spList);
    clientContext.ExecuteQuery();
    if (spList != null && spList.ItemCount > 0)
    Microsoft.SharePoint.Client.CamlQuery camlQuery = new CamlQuery();
    camlQuery.ViewXml =@"<View> <Query> <Where><Eq><FieldRef Name='LinkFilenameNoMenu' /><Value Type='Computed'>New Microsoft Word Document.docx </Value></Eq></Where> </Query> <ViewFields><FieldRef Name='Title' /></ViewFields> </View>";
    ListItemCollection listItems = spList.GetItems(camlQuery);
    clientContext.Load(listItems);
    clientContext.ExecuteQuery();
    listItems[0]["Title"] = "word.docx";
    listItems[0]["FileLeafRef"] = "word.docx";
    listItems[0].Update();
    clientContext.ExecuteQuery();
    More information about SharePoint Client Object Model:
    http://msdn.microsoft.com/en-us/library/office/ee537247(v=office.14).aspx
    http://www.codeproject.com/Articles/399156/SharePoint-Client-Object-Model-Introduction
    http://www.learningsharepoint.com/2010/07/12/programmatically-upload-document-using-client-object-model-sharepoint-2010/
    Best regards

  • Create folder in Document Library using Sharepoint 2010 Client Object Model

    I would like to check for the existence of a folder in s Sharepoint 2010 Document Library and if the folder is not found, create it. (I would then subsequently programmatically upload documents to that folder -- which I have figured out). Can someone
    please help me figure out how to check for the extistence of and then create a folder using the Sharepoint 2010 Client Object Model?

    You can use this:
    public static void CreateFolder_ClientOM(string listName, string folderName)
    ClientContext clientContext = new ClientContext("http://basesmc2008");
    Web web = clientContext.Web;
    List list = clientContext.Web.Lists.GetByTitle(listName);
    clientContext.Load(clientContext.Site);
    string targetFolderUrl = listName + "/" + folderName;
    Folder folder = web.GetFolderByServerRelativeUrl(targetFolderUrl);
    clientContext.Load(folder);
    bool exists = false;
    try
    clientContext.ExecuteQuery();
    exists = true;
    catch (Exception ex)
    if (!exists)
    ContentTypeCollection listContentTypes = list.ContentTypes;
    clientContext.Load(listContentTypes, types => types.Include
    (type => type.Id, type => type.Name,
    type => type.Parent));
    var result = clientContext.LoadQuery(listContentTypes.Where
    (c => c.Name == "Folder"));
    clientContext.ExecuteQuery();
    ContentType folderContentType = result.FirstOrDefault();
    ListItemCreationInformation newItemInfo = new ListItemCreationInformation();
    newItemInfo.UnderlyingObjectType = FileSystemObjectType.Folder;
    newItemInfo.LeafName = folderName;
    ListItem newListItem = list.AddItem(newItemInfo);
    newListItem["ContentTypeId"] = folderContentType.Id.ToString();
    newListItem["Title"] = folderName;
    newListItem.Update();
    clientContext.Load(list);
    clientContext.ExecuteQuery();
    Blog | SharePoint Field Notes Dev Tool |
    ClassMaster

Maybe you are looking for

  • Simple copy of reports not working - help please

    Hello I have this function that was written to copy a given report object to a given folder. The code is not working - the copyObj = col.Copy(obj,2) appears to be failing. Can anyone shed some light on this? Thank you in advance! - Russell My functio

  • Issue with Plastic Screen on S10-3t

    Seen a few listings on this issue but no resolution. I brought one of the first S10-3t in the UK. One day after travelling home and the bag being on my shoulder *and could only have been lightly knocked about* i noticed a small heirline crack on the

  • Can one create a script to determine the filepath of a PDF based on information entered into a form?

    I work for the IT department for a medical center and we are creating signable PDF forms so that our center can move toward a paperless system.  The center uses a program to organize all of the PDF forms once they are signed, but we are wanting to ma

  • Self-made ring tones & iOS 7 ?

    I made some ringe tones that used to work perfectly. After the iOS 7 update they don't appear on my iPhone, although I have selected "sync all ringtones". Does anyone know how I can get them back on my iPhone? Thank you very much!

  • Generating subtraction equations that only return positive values

    Hello! Can you please help me to create a random subtraction equation where the result will always be positive? For example, my current scripting will return something lilke 3-6=-3. I don't want equations like this- only postive answers. Thanks for y