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

Similar Messages

  • SharePoint 2010 client object model read survey list

    Hello all,
    please suggest me how to read
    questions and answers in a survey list using
    client object model
    if possible some code is fine.
    Like Cricket

    Hi,
    below is the code for reading the items from survey list in .Net managed client object modal share point 2010
    using (ClientContext context = new ClientContext("siteUrl"))
                    context.Credentials = System.Net.CredentialCache.DefaultNetworkCredentials;
                    Web web = context.Web;
                    context.Load(web);
                    List survey = web.Lists.GetByTitle("SurveyListName");
                    FieldCollection fldColl = survey.Fields;
                    context.Load(fldColl);
                    ListItemCollection coll = survey.GetItems(CamlQuery.CreateAllItemsQuery());
                    context.Load(survey);
                    context.Load(coll);
                    context.ExecuteQuery();
                    //Load the questions and answers in the dictionary object
                    Dictionary<string, List<string>> questionAnswers = new Dictionary<string, List<string>>();
                    foreach (Field fld in fldColl)
                        if (fld.FieldTypeKind == FieldType.Choice && !fld.FromBaseType)
                            foreach (ListItem item in coll)
                                if (item.FieldValues.ContainsKey(fld.InternalName))
                                    string value = item.FieldValues[fld.InternalName].ToString();
                                    if (!string.IsNullOrEmpty(value))
                                        if (!questionAnswers.ContainsKey(fld.Title))
                                            List<string> values = new List<string>();
                                            values.Add(value);
                                            questionAnswers.Add(fld.Title, values);
                                        else
                                            List<string> oldValues = questionAnswers[fld.Title];
                                            oldValues.Add(value);
                                            questionAnswers[fld.Title] = oldValues;
    Thanks,
    Anil
    Anil

  • Unable to create a new folder in document library of SharePoint 2010

    Hi There,
    Need some help regarding an issue which is occurring after migration from SP 2007 to 2010.
    We have recently migrated a site to SP 2010, after migration whenever i tried to create a new folder in a document library it gives me an error message below
    SPException: Can not find the form to create default data for the list
        Microsoft.SharePoint.Utilities.SPUtility.ThrowSPExceptionWithTraceTag (UInt32 TagId, ULSCat traceCategory, resourceId String, Object [] resourceArgs) 28098007 
        Microsoft.SharePoint.ApplicationPages.ListFormRedirect.InitializeQueryStringMembers () 1764 
        Microsoft.SharePoint.ApplicationPages.ListFormRedirect.OnLoad (EventArgs e) +25 
        System.Web.UI.Control.LoadRecursive () 66 
        System.Web.UI.Page.ProcessRequestMain (Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) 2428
    All the document libraries which are created with the custom list template has this problem. 
    Moreover, I have verified and found Upload.aspx page is available in Forms folder of a document library. 
    Can someone help me in resolving this issue.
    Thank you in advance.
    Vikram
    vikram padigala

    Hi,
    All the document libraries which are created with the custom list template has this problem. 
    Did you mean you had a custom library template?
    Did the issue occur in the library which created use the out of the box template, such as use the Document Library template?
    You can check with the OOB template library to test whether they had the same issue.
    If the OOB template library works well, the issue may be related to the custom library template.
    You can try to recreate a new custom template to check whether it works.
    To quickly and accurately find the issue , you can also check the event log and ULS log to see if anything unexpected occurred.
    For SharePoint 2010, by default, ULS log is at
    C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\14\LOGS
    Thanks & Regards,
    Jason
    Jason Guo
    TechNet Community Support

  • Sharepoint 2013 client object model FQL

    Hi,
    Im using Sharepoint 2013 client object model api and im trying to search on sharepoint by using FQL, but I dont get any results when Im using FQL, but when Im trying similar KQL syntax I get results.
    I''ve heard that I need to enable the FQL but I can't find how, In 2010 api its a proeprty in KeywordQuery class.
    code:
    KeywordQuery keyword = new KeywordQuery(client);
    // KQL
    keyword.QueryText = "title:mon*";
    // FQL
    keyword.QueryText = "starts-with(title:string("mon"))";
    Thank you

    To enable FQL, you have to copy the default result source and modify the Query Transformation string {?{searchTerms} -ContentClass=urn:content-class:SPSPeople}, at one of these
    levels -- Search Service Application (SSA), Site Collection, or Site -- and in one of the following ways:
    Remove the KQL filter, -ContentClass:urn:content-class:SPSPeople, from the Query Transformation. The resulting Query Transformation string will be: {?{searchTerms}}
    Replace the Query Transformation string with an FQL equivalent, such as {?andnot({searchTerms},filter(contentclass:"urn:content-class:SPSPeople*"))}.
    Source :http://msdn.microsoft.com/en-us/library/office/jj163973.aspx
    Bala

  • Unable to edit .vsdx visio file that is inside a document library using visio 2010 sp2

    I have Visio 2010 SP2 installed locally inside my machine. The current version can open vsdx files by doing some conversions. I got the following scenario inside my SharePoint server 2013:-
    Currently I have Visio file (with .vsdx extension) uploaded to my SharePoint 2013 document library.
    If I click on the Visio file I got the following dialog.
    I select “Edit”, click on ok.
    Then the visio 2010 application will convert the current file and open it locally inside my machine.
    But the opened file will have it name as “Copy (1) of ….”, as follow:-
    So if I do some changes to the Visio file and I click on save I will not be able to save my changes back to the SharePoint server’s document library. Now if I do the same steps for a .vsd file not .vsdx then I can directly open the Visio file (without any
    conversion process) and I will be able to save my changes back to SharePoint server.
    So can anyone advice how to be able to edit .vsdx files which are uploaded to SharePoint document library using visio 2010 SP2 ?
    Thanks

    Thank you for your ideas.
    After that last posting, but before your response, I asked them to add the local farm to their trusted sites zone. Several blogs I had encountered while searching had listed that as something they had tried.
    As soon as they added the site to their trusted site zone, the problems went away.
    It was definitely not all users - I only had 2 people directly contact me about the issue.
    I never got a chance to ask them about other SharePoint sites - they were working on the sites where they spent most of their time - I don't know if they had other sites.
    The old location and the new location of these 2 sites are in the same site collection - it was moving them from
    http://myfarm/sites/div/dept67/site1
    to
    http://myfarm/sites/div/dept64/site1
    basically (with the actual names changed to protect my job).
    The site collection is /sites/div . So the site collection features are the same.
    I suppose that the site features could have changed between the export and the import - but since things are working now and I didn't change any features, I don't think that it is.
    At this point, things appear to be working. However strange that seems to me.

  • Connecting a SharePoint 2013 Document Library to Outlook 2010 client

    Good Day,
    Can someone please confirm if you can connect a SharePoint 2013 Document Library to Outlook 2010 client?
    I have seen articles, like the one shown below for Outlook 2013 to SharePoint 2013;
    http://www.sharepointgeoff.com/how-to-connect-a-sharepoint-2013-document-library-to-outlook-2013/
    Please provide a link to documentation to validate what Outlook Office versions will support viewing Document Library from Outlook client from a SharePoint 2013 Document Library.
    Thanks in advance for taking the time to review my request.
    Regards,
    Mark

    Hi Mark,
    Per my understanding, you might want to connect SharePoint 2013 Document Library to Outlook 2010 client application.
    Yes, SharePoint 2013 Document Library can connect to Outlook 2010 client application, the connecting process is similar as what SharePoint 2013 connect to Outlook
    2013 client application does.
    Thanks
    TechNet Community Support
    Please remember to mark the replies as answers if they help, and unmark the answers if they provide no help. If you have feedback for TechNet Support, contact
    [email protected]

  • Retrieve all folder & sub folder from document library in sharePoint 2013

    Hi,
    I want to retrieve all the folder and sub folder from document library and bind it to the dropdownlist using server object model.
    I used the below query to get all folder and sub folder.\
    query.Query = @"<Query><Where><Eq><FieldRef
    Name='FSObjType' /><Value Type='Lookup'>1</Value></Eq></Where></Query>";
                      query.ViewAttributes
    ="Scope='RecursiveAll'";
                     query.ViewFields
    = "<FieldRef Name='Title'/>";
                      query.ViewFieldsOnly
    = true;
    but when I bind result with the dropdownlist,it displays the output as below
    Please Help
    Thank You

    Hi,
    Thanks for posting your issue, Kindly try out below mentioned CAML query to get all the Folders and Subfolders from Document Library
    <Query>
    <Where>
    <Contains>
    <FieldRef Name='FileLeafRef' />
    <Value Type='Text'>token</Value>
    </Contains>
    </Where>
    <OrderBy><FieldRef Name='FileDirRef' /></OrderBy>
    </Query>
    <ViewFields>
    <FieldRef Name='ID' />
    <FieldRef Name='LinkFilename' />
    <FieldRef Name='FileDirRef' />
    <FieldRef Name='FileLeafRef' />
    </ViewFields>
    <QueryOptions>
    <ViewAttributes Scope='Recursive' />
    <OptimizeFor>FolderUrls</OptimizeFor>
    </QueryOptions>
    Also, check out below mentioned URLs to fix this issue
    https://social.msdn.microsoft.com/Forums/office/en-US/35e799a1-9360-46e5-8719-dd35fdace7ea/filter-document-library-folder-through-caml-query?forum=sharepointdevelopmentlegacy
    http://www.ktskumar.com/blog/2009/07/retrieve-all-folders-from-list/
    I hope this is helpful to you, mark it as Helpful.
    If this works, Please mark it as Answered.
    Regards,
    Dharmendra Singh (MCPD-EA | MCTS)
    Blog : http://sharepoint-community.net/profile/DharmendraSingh

  • Get/retreive managed metadata column value from Document Library using SharePoint 2013 JSOM

    Hi,
    I am trying to retrieve managed metadata column (NewsCategory) value in SharePoint 2013 Document library using JSOM.
    I get "Object Object" rather than actual value.
    I tried:-
    var newsCat = item.get_item('NewsCategory');
    alert(newsCat) //Displays [Object Object]
    var newsCatLabel = newsCat.get_label();
    var newsCatId = newsCat.get_termGuid();
    But, I get the error "Object doesn't support property or method get_label()"
    I also tried :-
    var newsTags = item.get_item(' NewsCategory ');
    for (var i = 0; i < newsTags.get_count() ; i++) {
    var newsTag = newsTags.getItemAtIndex(i);
    var newsTagLabel = newsTag.get_label();
    var newsTagId = newsTag.get_termGuid();
    Even now I get the error "Object doesn't support property or method get_count()"
    I have included " NewsCategory " in the load request:- context.load(items, 'Include(File, NewsCategory)');
    Any idea what the issue is? Do I have to add any *.js file using $.getScript?
    I added following .js files
    var scriptbase = _spPageContextInfo.webServerRelativeUrl + "/_layouts/15/";
    $.getScript(scriptbase + "SP.Runtime.js", function () {
    $.getScript(scriptbase + "SP.js", function () {
    $.getScript(scriptbase + "SP.Core.js", function () {
    Thanks in Advance,

    Hi Patrick,
    I already added those references. I just pasted the parts of script snippet in my initial post. To avoid confusion I am pasting here complete script.
    2.1.1.min.js"></script>
    <script type="text/javascript">
    $(document).ready(function(){
    var scriptbase = _spPageContextInfo.webServerRelativeUrl + "/_layouts/15/";
    $.getScript(scriptbase + "SP.Runtime.js", function () {
    $.getScript(scriptbase + "SP.js", function () {
    $.getScript(scriptbase + "SP.Core.js", function () {
    function getdata() {
    var context = new SP.ClientContext.get_current();
    var web = context.get_web();
    var list = web.get_lists().getByTitle('Documents');
    var camlQuery = new SP.CamlQuery();
    var filterCategory = 'Solutions';
    var IDfromTaxonomyHiddenList = 15;
    camlQuery.set_viewXml('<View><Query><Where><Eq><FieldRef LookupId="TRUE" Name="'+filterCategory+'" /><Value Type="ID">' + IDfromTaxonomyHiddenList +'</Value></Eq></Where></Query></View>');
    /*the above CAML query successfully gets all the list items matching the criteria including "NewsCategory" managed metadata column values
    But when I try to display the value it retrieved it ouputs/emits Object Object rather than actual values */
    var items = list.getItems(camlQuery);
    context.load(items, 'Include(File,NewsCategory)');
    context.executeQueryAsync(
    Function.createDelegate(this, function (sender, args) {
    if (items.get_count() > 0) {
    var listItemEnumerator = items.getEnumerator();
    while (listItemEnumerator.moveNext()) {
    var oListItem = listItemEnumerator.get_current();
    var file = oListItem.get_file();
    var name = file.get_name();
    var newsCat = oListItem.get_item('NewsCategory'); alert(newsTags.constructor.getName());
    alert(newsCat) //Displays [Object Object]
    var newsCatLabel = newsCat.get_label(); // Here it errors out with message "Object doesn't support property or method get_label()"
    var newsCatId = newsCat.get_termGuid();
    } //end while
    }//end if
    Function.createDelegate(this, function (sender, args) {
    alert('Request failed. ' + args.get_message() + '\n' + args.get_stackTrace());
    ExecuteOrDelayUntilScriptLoaded(getdata, "SP.Core.js");
    </script>
    In the above script "var name = file.get_name(); " gets the exact file name.
    But the line "var newsCat = item.get_item('NewsCategory');
           alert(newsCat) //Displays [Object Object]  rather than actual value.
    Issue resolved replace "oListItem.get_item('NewsCategory');" with oListItem.get_item('NewsCategory').get_label();"
    Thanks

  • Sharepoint authentication Client object model for direct links

    We have a Sharepoint 2010 site and another website [ASP.Net Web API 2] which uses Client object model to get data from Sharepoint, this is an intranet environment.
    The Client object model part of it is working fine, if any user logs in, it works with that user credentials. But when a user tries to access a direct SP link, ex: a link to a document from a document library, it pops up a credentials window.
    How to get rid of this pop up window, or how to set the authentication for the entire server when the user logs in to our web api.

    Hi,
    The prompt for credential can be seen as a behavior by designed for the sake of safe and there are no solutions to avoid it at this moment per my knowledge. 
    Here is a similar thread will provide more information:
    http://social.msdn.microsoft.com/Forums/sharepoint/en-US/85b5d22a-88ed-4975-8de9-1d65df293aeb/avoiding-prompting-for-authentication-when-accessing-the-aspx-page-in-layouts-folder-from-my?forum=sharepointdevelopmentprevious
    Thanks
    Patrick Liang
    Forum Support
    Please remember to mark the replies as answers if they help and unmark them if they provide no help. If you have feedback for TechNet Subscriber Support, contact
    [email protected]
    Patrick Liang
    TechNet Community Support

  • SharePoint 2013 Client Object Model fetch image rendition info

    Hi,
    Below is the scenario I am trying with SharePoint 2013 managed client object model.
    FrontEnd: ASP.Net web application
    BackEnd: SharePoint 2013.
    I have a publishing image with rendition applied and I am able to fetch the image URL like "/{site}/{lib}/{imagename}?RenditionId={id}".
    I am able to download the file "/{site}/{lib}/{imagename}" using File.OpenBinaryDirect() 
    This is giving the original file without any renditions applied. If I use the same method with URL "/{site}/{lib}/{imagename}?RenditionId={id}", it gives me 400 Bad request error.
    I have also tried using file.OpenBinaryStream() method with URL "/{site}/{lib}/{imagename}?RenditionId={id}" whichi still gives the original file without rendition
    Please let me know how to fetch the below info using the rendition id?
    RenditionVersion;
    SourceImageWidth;
    SourceImageHeight;
    CropStartX;
    CropStartY;
    CropWidth;
    CropHeight;
    Alternatively, let me know if I could get the download file with rendition applied without requiring the above attributes.
    Note: I am looking for solutions in client side programming (client object model/ web services (REST) .  The server object model has classes "ImageRenditionCollection" and "ImageRendition" which can provide the above image info.
    Thanks,
    Srikanth

    To enable FQL, you have to copy the default result source and modify the Query Transformation string {?{searchTerms} -ContentClass=urn:content-class:SPSPeople}, at one of these
    levels -- Search Service Application (SSA), Site Collection, or Site -- and in one of the following ways:
    Remove the KQL filter, -ContentClass:urn:content-class:SPSPeople, from the Query Transformation. The resulting Query Transformation string will be: {?{searchTerms}}
    Replace the Query Transformation string with an FQL equivalent, such as {?andnot({searchTerms},filter(contentclass:"urn:content-class:SPSPeople*"))}.
    Source :http://msdn.microsoft.com/en-us/library/office/jj163973.aspx
    Bala

  • How to Copy list item attachment to document library in SharePoint 2010

    Hi,
    How to Create a folder ("List Item - Title Name") in Document library and copy list items Attachments to the same folder in SharePoint 2010,thanks in advance.
    Regards,
    Selvan.J
    Selvan J

    Hi,
    You should first check whether the folder exists in the library, if the folder not exists, then create it.
    I had modified the code, you can use the following code snippet to achieve it.
    private void EventCopyFileWhenItemCreatedOrUpdated(SPItemEventProperties properties)
    SPSite site = new SPSite(http://YourSiteName);
    SPWeb web = site.OpenWeb();
    SPList doclibList=properties.Web.Lists["YourLibName"];
    bool foundFolder = false;
    if (doclibList.Folders.Count>0)
    foreach (SPListItem fitem in doclibList.Folders)
    if (fitem.Title.Equals("FolderA"))
    foundFolder = true;
    break;
    if (foundFolder == false)
    SPListItem folder = doclibList.Folders.Add(doclibList.RootFolder.ServerRelativeUrl, SPFileSystemObjectType.Folder,"FolderA");
    folder.Update();
    string fUrl = doclibList.RootFolder.ServerRelativeUrl+"/FolderA";
    SPFolder myLibrary = web.GetFolder(fUrl);
    if (properties.ListTitle == "YourListName")
    SPListItem sourceItem = properties.ListItem;
    properties.Web.AllowUnsafeUpdates = true;
    //get the folder with the attachments for the source item
    SPFolder sourceItemAttachmentsFolder =
    sourceItem.Web.Folders["Lists"].SubFolders[sourceItem.ParentList.Title].SubFolders["Attachments"].SubFolders[sourceItem.ID.ToString()];
    //Loop over the attachments, and add them to the target item
    foreach (SPFile file in sourceItemAttachmentsFolder.Files)
    if (CheckFileNameExist(file.Name , properties) == false)
    byte[] binFile = file.OpenBinary();
    myLibrary.Files.Add(System.IO.Path.GetFileName(file.Url) , binFile);
    private bool CheckFileNameExist(string fileNameInFileAttach, SPItemEventProperties properties)
    bool flag = false;
    SPList myDocumentLib = properties.Web.Lists["YourLibName"];
    SPQuery spQuery = new SPQuery();
    SPListItemCollection items = myDocumentLib.GetItems(spQuery);
    foreach (SPListItem item in items)
    if (fileNameInFileAttach == item["Name"].ToString())
    flag = true;
    break;
    return flag;
    Thanks & Regards,
    Jason
    Jason Guo
    TechNet Community Support

  • How to make New Document and Upload Document to have same Content Type in Document Library in Sharepoint 2010

    Hi,
    How to make 'New Document' and 'Upload Document' to have same content type(Custom) in Document Library in Sharepoint2010.
    Note : I have created custom Content Type since I have custom columns along with upload column..
    Regards, Shreyas R S

    go to library settings 
    Change new button order and default content type
    set your custom content type to be #1
    when you upload new document it will automatically have your custom content type
    Hope that helps|Amr Fouad|MCTS,MCPD sharePoint 2010

  • Getting correlation error while opening document library in SharePoint 2010

    Hi,
    I installed SQL Server 2008 R2 SP1 and SharePoint 2010 on Windows Server 2008 R2. Everything went fine for first days. Now I am getting error while opening any of the document libraries. However lists are opening fine.
    Error:
    An unexpected error has occured.
    Troubleshoot issues with Microsoft SharePoint Foundation
    Correlation ID: fa54267f-4436-8298-c7698977728c
    I checked the logs, I showing some error with the line http://Microsoft.Office.Server.UserProfiles/GetProfileProperties
    Please let me know if you have any idea about this error or let me know if you need further inputs from me. Thanks.

    Hi Tarique,
    Whether you have granted the user proper permissions on this site. You should make sure the user has permissions on the site.
    In addition, there are some reasons for the log-in issue, please take a look at:
    http://sharepointsolutions.blogspot.com/2008/06/how-do-i-make-our-sharepoint-site-stop.html
    http://sharepointsolutions.blogspot.com/2008/06/how-do-i-make-our-sharepoint-site-stop_17.html
    http://dinesql.blogspot.com/2011/01/cannot-login-to-sharepoint-2010-site.html
    I hope this helps.
    Thanks,
    Wendy
    Wendy Li
    TechNet Community Support

  • Configure site auditing in sharepoint online using powershell or Client object model

    Is the any way to configure site collection audit settings in sharepoint online programmatically or using powershell.

    Hi Bhism,
    The solution given in the article is for sharepoint 2010, i want to enable site auditing in Sharepoint 2013.
    When i tried using that for sharepoint 2013 making he neccessary changes required for sharepoint 2013 i got an error :
    Unable to find type [Microsoft.SharePoint.SPAuditMaskType]: make sure that the
    assembly containing this type is loaded.
    I think the assembly is for SP2010, is there anything like that for SP2013
    Thanks in Advance.

  • Cannot create list in SharePoint 2010 using Client Object Model

    I am trying to utilize SharePoint 2010 Client Object Model to create a List based on a custom template. Here's my code:
    public void MakeList(string title, string listTemplateGUID, int localeIdentifier)
    string message;
    string listUrl;
    List newList;
    Guid template;
    ListCreationInformation listInfo;
    Microsoft.SharePoint.Client.ListCollection lists;
    try
    listUrl = title.Replace(spaceChar, string.Empty);
    template = GetListTemplate((uint)localeIdentifier, listTemplateGUID);
    listInfo = new ListCreationInformation();
    listInfo.Url = listUrl;
    listInfo.Title = title;
    listInfo.Description = string.Empty;
    listInfo.TemplateFeatureId = template;
    listInfo.QuickLaunchOption = QuickLaunchOptions.On;
    clientContext.Load(site);
    clientContext.ExecuteQuery();
    lists = site.Lists;
    clientContext.Load(lists);
    clientContext.ExecuteQuery();
    newList = lists.Add(listInfo);
    clientContext.ExecuteQuery();
    catch (ServerException ex)
    Now, this particular part, newList = lists.Add(listInfo); clientContext.ExecuteQuery();, the one that is supposed to create the actual list, throws an exception:
    Message: Cannot complete this action. Please try again.
    ServerErrorCode: 2130239231
    ServerErrorTypeName: Microsoft.SharePoint.SPException
    Could anyone please help me realize what am I doing wrong? Thanks.

    I've made progress - well, at least to some extent. The previous message related to the "Invalid file name" is not appearing any more. I now realize that it is necessary to specify feature ID, list template kind, as well as custom schema in order
    to order SharePoint 2010 to create the document library. 
    However, there's a new problem which isn't documented on the net almost at all (at least I was unable to find anything): The document library gets created, but I cannot access it. Further inspection showed that the doc lib views are not created. Basically,
    the only accessible doc lib page is the document library settings page. Also, I get the server exception with the message: 
    Server Out Of Memory. There is no memory on the server to run your program. Please contact your administrator with this problem.
    Any idea what is causing this issue? Thanks. 
    Hi Boris
    Borenović,
    I think I found the reason for this notorious "Server Out Of Memory" error.
    (Man, it took 4 hrs of frustrating troubleshooting without any direct hints... very disappointing
    MSFT developers :( ).
    Anyway,
    All the "Form" elements at the bottom need to have SetupPath="pages\form.aspx"
    attribute (by default this attrib is missing when you copy the whole List element from inside the stp's manifest.xml  file).
    Also, just make sure that each "View" element has correct "WebPartZoneID", "SetupPath" and "Url" attribute values otherwise that list/library will
    be created successfully but will fail to load when you try to access it (with the VERY helpful "Cannot complete this action, contact administrator" error). Even if you enable stack trace (or check ULS logs) you will find "An unexpected
    error has been encountered in this Web Part.  Error: A Web Part or Web Form Control on this Page cannot be displayed or imported. The type could not be found or it is not registered as safe." and you will never realize it's because of the
    incorrect attributes ("WebPartZoneID", "SetupPath" or "Url" as mentioned above).
    Come on Microsoft, you can do better than that?
    If the API needs this attrib then why is it missing inside the manifest.xml file when
    an STP file generated in the first place?

Maybe you are looking for

  • Keyboard button inactive with Leopard

    After installing Leopard the other day, my tray open/close button on the keyboard is completely unresponsive and i can't seem to solve the issue - anyone else come across this or have any solutions? The only way to close the tray at the moment seems

  • System command Correspondence to HTBASIC

    I am creating Labview programs  corresponding to HTBASIC  programs. I cannot find some system level commands such as ABORT 7. Does there exist a correspondence list?

  • For third party email users

    AKA anything that isn't @verizon.net (ie @hotmail.com, @juno.com) Verizon is blocking port 25, please check: http://www22.verizon.com/ResidentialHelp/HighSpeed/General+Support/Top+Questions/QuestionsOne/124274... Reason:  Most common email viruses ar

  • VARCHAR2 1 or 255 whats the difference

    What is the disadvantage of declaring a string field as varchar2(255) when you know that there will always be less characters in it. eg a telephone number. I am thinking of trying to have a few standard field definitions accros the whole database and

  • I was given Photoshop CS5 Extended as a gift

    When I put in the serial number it tells me that it is not a valid number.  How to I download this to my computer.  I have a new computer with Windows 8.1 and I am not use to this operating system at all. Any help would be greatly appreciated.  It is