Creating a subsite in hostweb from sharepoint hosted App

Hello All,
While creating a subsite in host web from sharepoint app, i am getting error the in the below line of code
"   this.NewWebsite = hostweb.get_webs().add(webCreateInfo);"..unable to get the property "get_webs";
My code is as below
$(document).ready(
    function () {
             var hostUrl = decodeURIComponent(getQueryStringParameter("SPHostUrl"));
               currentcontext = new SP.ClientContext.get_current();
                var hostcontext = new SP.AppContextSite(currentcontext, hostUrl);
             var hostweb = hostcontext.get_web();
               var currentcontext.load(hostweb, "Title");
         var webCreateInfo = new SP.WebCreationInformation();
        //set values
        webCreateInfo.set_description("This site is created from CSOM");
        webCreateInfo.set_language(1033);
        webCreateInfo.set_title("My Title");
        webCreateInfo.set_url("/myURL");
        webCreateInfo.set_useSamePermissionsAsParentSite(true);
        webCreateInfo.set_webTemplate("STS#0");
        //add sub site
        this.NewWebsite = hostweb.get_webs().add(webCreateInfo);
        //Load and execute query
        currentcontext.load(this.NewWebsite, 'ServerRelativeUrl', 'Created');
        currentcontext.executeQueryAsync(Function.createDelegate(this, this.Success), Function.createDelegate(this, this.oncListQueryFailed));
function Success() {
    alert(this.NewWebsite.get_serverRelativeUrl());
function oncListQueryFailed(sender, args) {
    alert('Request failed. ' + args.get_message() + '\n' + args.get_stackTrace());
Any help will be appreciated
dfd

Hello Steve,
Thanks for the Reply
Following code helped me in creating the Subsite successfully in host web
Var hostWebUrl;
Var appWebUrl;
Var context;
Var newSubsite;
function () {
try
hostWebUrl = GetQueryString("SPHostUrl");
appWebUrl = GetQueryString ("SPAppWebUrl");
var layoutsRoot = hostWebUrl +
'/_layouts/15/';
$.getScript(layoutsRoot + "SP.Runtime.js",
function () {
$.getScript(layoutsRoot + "SP.js", CreateSubsite);});
catch(ex)
alert("message" + ex.message);
function GetQueryString (name) {
name = name.replace(/[\[]/,
"\\\[").replace(/[\]]/,
var regex =
new RegExp("[\\?&]"
+ name + "=([^&#]*)"),
results = regex.exec(location.search);
return results ==
null ?
"" : decodeURIComponent(results[1].replace(/\+/g,
// Function to create subsite
function CreateSubsite () {
context = new SP.ClientContext(appWebUrl);
var hostContext =
new SP.AppContextSite(context, hostWebUrl);
var webCreateInfo =
new SP.WebCreationInformation();
//set values
webCreateInfo.set_description("New Subsite Created");
webCreateInfo.set_language(1033);
webCreateInfo.set_title("NewSubSite");
webCreateInfo.set_url("SubsiteURL");
webCreateInfo.set_useSamePermissionsAsParentSite(true);
webCreateInfo.set_webTemplate("STS#0");
 this.web = hostContext.get_web();
newSubsite = this.web.get_webs().add(webCreateInfo);
context.load(newSubsite);
context.executeQueryAsync(
Function.createDelegate(this,successHandler),Function.createDelegate(this,errorHandler));
function successHandler() {
alert("subsite created successfully");
function errorHandler(sender, args) {
alert("Could not complete cross-domain call: " + args.get_message());
Vishnu

Similar Messages

  • SharePoint hosted app error log

    Hi,
      I'd like to log the error in ULS log from sharepoint hosted app [Client side]. Is it possible, if yes, please let me know how to do it..
    Balaji -Please click mark as answer if my reply solves your problem.

    Hi,
    You could write informations to the "App Error Log".
    Have a look at these links :
    http://exxlence.com/2013/01/07/add-logging-to-your-sharepoint-app-using-logcustomapperror-method/
    http://sp2013.blogspot.fr/2013/01/sharepoint-apps-logging.html
    Regards
    Gilles Martinez
    Twitter
    Blog
    Please mark as helpful/answer if this resolved your post

  • How to get hostweb's site collection in SharePoint hosted app?

    I want display SharePoint site collection of host web in my SharePoint hosted app. I have used following code. 
    ExecuteOrDelayUntilScriptLoaded(callSharePoint, "sp.js");
    function callSharePoint() {
    hostweburl = getQueryStringParameter("SPHostUrl");
    appweburl = getQueryStringParameter("SPAppWebUrl");
    hostweburl = decodeURIComponent(hostweburl);
    appweburl = decodeURIComponent(appweburl);
    var scriptbase = appweburl + "/_layouts/15/";
    $.getScript(scriptbase + "SP.Runtime.js",
    function () {
    $.getScript(scriptbase + "SP.js",
    function () {
    //$.getScript(scriptbase + "SP.Taxonomy.js", function () { });
    $.getScript(scriptbase + "SP.RequestExecutor.js", execOperation);
    //Loads context, web and lists....
    function execOperation() {
    try {
    //create context for appweburl.
    context = new SP.ClientContext(appweburl);
    var factory = new SP.ProxyWebRequestExecutorFactory(appweburl);
    context.set_webRequestExecutorFactory(factory);
    //get hostsite reference & load as web.
    appContextSite = new SP.AppContextSite(context, hostweburl);
    web = appContextSite.get_web();
    context.load(web);
    list = web.get_lists();
    context.load(list);
    webs = appContextSite.get_web().get_webs();
    context.load(webs);
    //webs = appContextSite.get_site().get_rootWeb().get_webs();
    //context.load(webs);
    context.executeQueryAsync(onWebsLoaded, onQueryFailed);
    catch (err) {
    alert(err.message);
    function onWebsLoaded(sender, args) {
    alert(list.get_count());
    var webEnum = list.getEnumerator();
    while (webEnum.moveNext()) {
    web = webEnum.get_current();
    alert(web.get_id());
    for (var i = 0; i < webs.get_count() ; i++) {
    subwebs = webs.itemAt(i);
    recursiveAll(subwebs);
    /* recursive call for web */
    function recursiveAll(cweb) {
    debugger;
    alert(cweb.get_title());
    var subwebs = cweb.get_webs();
    context.load(subwebs);
    context.executeQueryAsync(function (sender, args) {
    debugger;
    var webEnum = subwebs.getEnumerator();
    while (webEnum.moveNext()) {
    web = webEnum.get_current();
    alert(web.get_title());
    //recursive call for current web.
    recursiveAll(web);
    }, function () { debugger; alert('err'); });
    In this code I have get all the list of the Host web. But I am not able to get Host webs.
    Any of the when I load the Web it gives me the AppWebUrl not the host web.
    So I tried by using following code
    context = new SP.ClientContext(hostweburl);
    web = appContextSite.get_web();
    context.load(web);
    context.executeQueryAsync(onWebsLoaded, onQueryFailed);
    But it gives me error: unexpected response data from server
    Is there any other way to view all sites and sub sites of the host web in SharePoint hosted app?

    Hi,
    Since you are using a provider Hosted app if you want to get the current logged in name than do not use AppOnlyAccessToken else use AccessToken which is App + user Context AccessToken.
    then 
    Web web = clientContext.Web;
    clientContext.Load(web);
    clientContext.ExecuteQuery();
    clientContext.Load(web.CurrentUser);
    clientContext.ExecuteQuery();
    clientContext.Web.CurrentUser.LoginName;will return proper user Name.
    HttpContext.Current.User.Identity.Name will never return the user as this object is related to IIS server of your App Server not sharepoint.you should set this as Anonymous in case of provider hosted app.you can download the below sample which uses the AccessToken which has user name in it.https://code.msdn.microsoft.com/Working-provider-hosted-8fdf2d95
    Whenever you see a reply and if you think is helpful,Vote As Helpful! And whenever you see a reply being an answer to the question of the thread, click Mark As Answer

  • SharePoint Hosted App - Creating cascaded drop down on hosted web lists

    Hi,
    I have created an SharePoint Hosted App(Javascript Object Model) that creates lists on the host web.
    I need to put some javascript into new and edit forms in order to create the cascaded drop down effect on 2 lookup fields.
    Can you please give me some advise?
    Regards,
    Marian

    Hope below article should help you
    http://blog.pentalogic.net/2010/11/editing-the-sharepoint-list-item-menu-part-2-using-javascript/
    http://www.getinthesky.com/2014/03/hide-text-field-sharepoint-form-using-jquery/
    http://social.msdn.microsoft.com/Forums/sharepoint/en-US/030471b2-d19a-470f-9a9e-0fd8a229138b/how-do-i-create-a-new-item-form-that-allows-to-save-and-continue-editing?forum=sharepointcustomizationlegacy

  • Call EWS from SharePoint 2013 SharePoint Hosted App (JavaScript) in Office 365

    I am trying to call the exchange web service (EWS) of an exchange online server from a SharePoint hosted app. I am limited thus to the use of Javascript. During my call i am always getting an access denied error.
    The body of the SOAP request is good since I have tested it using a client application, but I am not being able to get it to work via a jquery ajax call. I am sure that this is an authentification issue and I have no problem sending the credentials during
    the call. I have added them in the header. This is what I have ended up doing but still no luck.
    functionGetUnReadEmailCount() {
    varsoapPacket = "<?xml version='1.0' encoding='utf-8'?>"+
    "<soap:Envelope xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance' xmlns:xsd='http://www.w3.org/2001/XMLSchema' xmlns:soap='http://schemas.xmlsoap.org/soap/envelope/'xmlns:t='http://schemas.microsoft.com/exchange/services/2006/types'>"+
    '<soap:Header>'+
    '<wsse:Security>'+
    '<wsse:UsernameToken>'+
    '<wsse:Username>******</wsse:Username>'+
    '<wsse:Password>******</wsse:Password>'+
    '</wsse:UsernameToken>'+
    '</wsse:Security>'+
    '</soap:Header>'+
    "<soap:Body>"+
    "<FindItem xmlns='http://schemas.microsoft.com/exchange/services/2006/messages' xmlns:t='http://schemas.microsoft.com/exchange/services/2006/types'Traversal='Shallow'>"+
    "<ItemShape>"+
    "<t:BaseShape>IdOnly</t:BaseShape>"+
    "</ItemShape>"+
    "<IndexedPageItemView MaxEntriesReturned='50' Offset='0' BasePoint='Beginning' />"+
    "<Restriction>"+
    "<t:IsEqualTo>"+
    "<t:FieldURI FieldURI='message:IsRead' />"+
    "<t:FieldURIOrConstant>"+
    "<t:Constant Value='false' />"+
    "</t:FieldURIOrConstant>"+
    "</t:IsEqualTo>"+
    "</Restriction>"+
    "<ParentFolderIds>"+
    "<t:DistinguishedFolderId Id='inbox' />"+
    "</ParentFolderIds>"+
    "</FindItem>"+
    "</soap:Body>"+
    "</soap:Envelope>";
    $.support.cors = true;
    $.ajax({
            url: "https://outlook.office365.com/EWS/Exchange.asmx",
            type: "POST",
            dataType: "xml",
            data: soapPacket,
            complete: processResult,
            error: OnError,
            contentType: "text/xml; charset=\"utf-8\""
    Any help is highly appreciated.
    Thanks.
    Elie

    Hi Elie,
    Since this forum is discussing about Developing Apps for Office 2013, and your issue is more related about Exchange development. I will move this thread to the more related forum.
    Reference:
    https://social.msdn.microsoft.com/Forums/en-US/home?forum=exchangesvrdevelopment
    Thanks for your understanding.
    Best Regards,
    Edward
    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click
    HERE to participate the survey.

  • Create SharePoint hosted app when i debug project in IE browser getting error "Operation aborted" .

    Hi all,
    I am create SharePoint hosted app for SharePoint online. When i debugs project in IE browser getting error "Operation aborted".
     Please Suggest appropriate Way.
    Thanks
    Akash Anand 

    This happens sometimes if you are using third party library which IE does not support. Change the default browser of Visual Studio to Google Chrome and try.
    Let us know either it works or not
    Regards
    Khalil Kothia, PMP
    Blog

  • Can't add images to announcements in SharePoint-hosted app in Office 365

    I tried something very simple:
    Create a new SharePoint-hosted app
    Add a new list to the app, based on the Announcements template
    Deploy the app to my Dev site on Office 365
    When I now add a new item (aka a new announcement) and try to add an image to the Body field, I encounter two errors (depending on whether I try to add an image from my Computer or from SharePoint)
    Adding from my computer gives me an unexpected error:
    Adding from SharePoint shows me a structure of all the apps in my hostweb, but no way to upload an image either to the hostweb or the appweb:
    Is it not possible to add images to a Rich Text field in a list in an app?

    Hi Rene,
    For inserting any image from you computer to you App web, you need to create a separate picture library in your app web manually i.e. in your SharePoint hosted app add a new list item, under list settings window choose "create a list instance
    base on existing list template" and in the drop down select
    picture library. Now deploy the app and try again.
    Generally when we insert any image from our computer to a SharePoint rich text field, the image gets upload in one of the document libraries, but this option is not available in the newly created app web, as it doesn't contains any separate library..
    For you next error, make sure that in the app manifest you are providing
    read access on the web, this will resolve you second problem.
    Hope it helps you.....

  • Web event receiver when adding or deleting a SharePoint hosted app

    Hi,
    Is it possible to start an action when a SharePoint hosted app is added or deleted from a site collection on our SharePoint 2013 farm on premise?
    Also for public apps. Therefore, working with ‘App events’ are not an option.
    It tried already with a web event receiver: ‘OnSiteCreated’ and ‘WebDeleting’, but this is not working with appweb's.
    When I create a normal subsite, the event is fired. When I added an app to the site, the event is not fired.
    Regards,
    Johan

    Hi Johan,
    yes you can do that, try the following:
    https://msdn.microsoft.com/en-us/library/office/jj220048(v=office.15).aspx#APPRER
    https://msdn.microsoft.com/en-us/library/office/jj220052(v=office.15).aspx
    Kind Regards,
    John Naguib
    Technical Consultant/Architect
    MCITP, MCPD, MCTS, MCT, TOGAF 9 Foundation
    Please remember to mark your question as answered if this solves your problem

  • Unable to update rating (rating column) on host document using JavaScript Object Model API inside sharepoint hosted apps

    Hi Everyone,
    We are developing SharePoint hosted apps for Office 365, for that we are going
    to implement document rating functionality inside Sharepoint app. The host web contain document library (“Documents”) and from apps we need to rate each document. The rating functionality working fine with CQWP in team site  using
    JavaScript Object Model API.
    But the same code is not working inside apps and giving error:-
    If we are using app context than error will be:-
    "List does not exist.
    The page you selected contains a list that does not exist.  It may have been deleted by another user."
    And for Host context than error will be:-
    "Unexpected response data from server."
    Please help on this
    Please see below code..
    'use strict';
    var web, list, listItems, hostUrl, videoId, output = "";
    var videoLibrary = "Documents";
    var context, currentContext;
    var lists, listID;
    var list, parentContext;
    var scriptbase;
    (function () {
        // This code runs when the DOM is ready and creates a context object which is 
        // needed to use the SharePoint object model
        $(document).ready(function () {
            hostUrl = decodeURIComponent(getQueryStringParameter("SPHostUrl"));
            context = SP.ClientContext.get_current();      
            SP.SOD.executeFunc('sp.js', 'SP.ClientContext', sharePointReady);
        function sharePointReady() {
            scriptbase = hostUrl + "/_layouts/15/";
            // Load the js files and continue to the successHandler
            $.getScript(scriptbase + "SP.Runtime.js", function () {
                $.getScript(scriptbase + "SP.js", function () {
                    $.getScript(scriptbase + "SP.Core.js", function () {
                        $.getScript(scriptbase + "reputation.js", function () {
                            $.getScript(scriptbase + "sp.requestexecutor.js", execCrossDomainRequest);
        //Query list from hostweb
        function execCrossDomainRequest() {       
            //Load the list from hostweb
            parentContext = new SP.AppContextSite(context, hostUrl);
            web = parentContext.get_web();
            list = web.get_lists().getByTitle(videoLibrary);
            context.load(list, 'Title', 'Id');
            var camlQuery = new SP.CamlQuery();
            camlQuery.set_viewXml('<View><Query><OrderBy><FieldRef Name="Modified" Ascending="FALSE"/></OrderBy></Query><RowLimit>1</RowLimit></View>');
            listItems = list.getItems(camlQuery);        
            context.load(listItems);
            context.executeQueryAsync(onQuerySucceeded, onQueryFailed);
        //Process the image library
        function onQuerySucceeded() {       
            var lstID = list.get_id();
            var ctx = new SP.ClientContext(hostUrl);       
            var ratingValue = 4;
            EnsureScriptFunc('reputation.js', 'Microsoft.Office.Server.ReputationModel.Reputation', function() {      
            Microsoft.Office.Server.ReputationModel.Reputation.setRating(ctx, lstID, 1, ratingValue);       
            ctx.executeQueryAsync(RatingSuccess, RatingFailure);
        function onQueryFailed(sender, args) {
            alert('Failed' + args.get_message());
        function failed(sender, args) {
            alert("failed because:" + args.get_message());
        function RatingSuccess() {
            alert('rating set');
            //displaystar();
        function RatingFailure(sender, args) {
            alert('Rating failed : : ' + args.get_message());
        //Gets the query string paramter
        function getQueryStringParameter(paramToRetrieve) {
            var params;
            params = document.URL.split("?")[1].split("&");
            for (var i = 0; i < params.length; i = i + 1) {
                var singleParam = params[i].split("=");
                if (singleParam[0] == paramToRetrieve) return singleParam[1];
    Thanks & Regards
    Sanjay 
    Thank you in advance! :-)
          

    Hi,
    According to your post, my understanding is that you want to update list column in SharePoint hosted apps using JavaScript Client Object Model.
    Based on the error message, it seems not retrieve the list object in context. I suggest you debug the code step by step using Internet Explorer Developer Tools to
    find the problem.
    Here are some demos about using JavaScript Client Object Model in SharePoint hosted app:
    http://blogs.msdn.com/b/officeapps/archive/2012/09/04/using-the-javascript-object-model-jsom-in-apps-for-sharepoint.aspx
    http://sharepoint.stackexchange.com/questions/55334/how-to-access-list-in-sharepoint-hosted-app
    http://www.dotnetcurry.com/showarticle.aspx?ID=1028
    Best regards
    Zhengyu Guo
    TechNet Community Support

  • How to open List when Page loads in SharePoint Hosted App?

    I  want to create an app same like InstantPracticeManager by InstantQuick.
    Now I want to know that in a SharePoint Hosted App How can I show the Whole List in a page. 
    Here I have added one image:
    Here there is one list and there are 4 views of that list.
    Now the App will be like when I load the page It will show like the image above. Now how can we show the list like this in sharepoint hosted app?
    I want the same scenario which is shown in the following blogs:
    http://sp2013.blogspot.in/2012/08/use-list-view-in-sharepoint-2013-apps.html
    and
    http://www.sharepointnutsandbolts.com/2013/08/working-with-web-parts-within.html
    where they add a list to an app
    Can any one suggest me the idea? I am bit confused.
    thanks in advance.

    Hi,
    According to your post, my understanding is that you want to show the different list view in a page in SharePoint Hosted App.
    We can use jQuery and cross-domain library to achieve it.
    The following articles for your reference:
    Adding a Tabbed View to A Web Part Page Using jQueryUI
    http://sympmarc.com/2011/11/09/adding-a-tabbed-view-to-a-web-part-page-using-jqueryui/
    How to: Access SharePoint 2013 data from apps using the cross-domain library
    http://msdn.microsoft.com/en-us/library/office/fp179927(v=office.15).aspx
    SharePoint 2013: Get list items by using the cross-domain library (JSOM)
    http://code.msdn.microsoft.com/office/SharePoint-2013-Get-items-d48150ae/view/SourceCode#content
    Thanks,
    Dennis Guo
    TechNet Community 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]
    Dennis Guo
    TechNet Community Support

  • Unable to add aspx file to document library using REST and JSOM in SharePoint Hosted App

    Hi,
    I am unable to add an aspx file to document library.  I was actually trying to create a WIKI page and upload to Pages library but that wasn't working so I tried simple document library.  It keeps failing with Access Denied error.  I have checked
    the blocked types and aspx is not included.  I can upload it directly from the browser so that shouldn't be the case.  I have read that it can be achieved with CSOM but I need this to work with a SharePoint Hosted App.  Here is my JSOM:
    factory = new SP.ProxyWebRequestExecutorFactory(appweburl);
        context.set_webRequestExecutorFactory(factory);
        appContextSite = new SP.AppContextSite(context, hostweburl);
        oWeb = appContextSite.get_web();
        oList = oWeb.get_lists().getByTitle('Documents');
        fileCreateInfo = new SP.FileCreationInformation();
        fileCreateInfo.set_url("mywiki.aspx");
        fileCreateInfo.set_content(new SP.Base64EncodedByteArray());
        fileContent = "<%@ Page Inherits=\"Microsoft.SharePoint.Publishing.TemplateRedirectionPage,Microsoft.SharePoint.Publishing,Version=15.0.0.0,Culture=neutral,PublicKeyToken=71e9bce111e9429c\" %> <%@ Reference VirtualPath=\"~TemplatePageUrl\"
    %> <%@ Reference VirtualPath=\"~masterurl/custom.master\" %>";
        for (var i = 0; i < fileContent.length; i++) {
            fileCreateInfo.get_content().append(fileContent.charCodeAt(i));
        newFile = oList.get_rootFolder().get_files().add(fileCreateInfo);
        context.load(newFile);
        context.executeQueryAsync(function () {
            alert('yo');
        }, function (sender, args) {
            alert(args.get_message() + '\n' + args.get_stackTrace());
    If I change the file extension to "txt", it works.  Same with REST implementation, it works with "txt" but fails with "aspx".  Maybe what I am trying to do will not work using JSOM or REST.  Any suggestions?  Your
    help is always appreciated.
    Regards,
    kashif

    Your code works fine in both my on-premises and SharePoint Online. I have given the app full control, so I suspect this is a permissions issue. I would check your permissions on your appmanifest. Must be something to do with publishing permissions. Try
    giving full control and work the permissions down.
    Blog | SharePoint Field Notes Dev Tools |
    SPFastDeploy | SPRemoteAPIExplorer

  • SharePoint hosted app issue - This page cannot be displayed

    Hi All, need help on below issue, 
    When I deploy SharePoint hosted app from Visual Studio 2012, it generated app web URL and that opens the app properly. But, if I upload .app file after
    publish in Visual Studio 2012 to App Catalog and added new app based on my SharePoint hosted app. When try to click on app, saying ‘This page can’t be displayed’ in internet explorer. I don’t think so it will be issue with app domain as the app working fine
    if deploy from visual studio. Thanks in advance for your help.

    It may still be an issue with the app domain, actually with DNS.  When you deploy from VS 2012 it automatically adds the appropriate DNS entries to the Hosts file on your VS 2012 PC.  That way the App domain can be resolved and you can reach the
    site.  When you deploy by uploading to the App Catalog that entry in the HOsts file is not created.  Instead you should ahve already added the App domain and a wildcard entry to the DNS server used in your network.  If that wasn't done then
    you will get exactly the behavior you describe.
    Take a look at the section on DNS in the following article.  Make sure you've followed all the instructions.
    http://technet.microsoft.com/en-us/library/fp161236(v=office.15).aspx
    Paul Stork SharePoint Server MVP
    Principal Architect: Blue Chip Consulting Group
    Blog: http://dontpapanic.com/blog
    Twitter: Follow @pstork
    Please remember to mark your question as "answered" if this solves your problem.

  • Deployed lists in a SharePoint hosted app use the wrong content type.

    I am using Visual Studio Ultimate 2013 to deploy a SharePoint hosted app to my SharePoint 2013 development environment. 
    I have created 2 lists, one of which is using a custom content type with custom columns and the other is just a simple custom list definition and instance, all of which are deployed inside the same feature.
    However when I go to the simple list, it is using the content type from the other list, even though in the schema.xml shows that it is not supposed to use this content type. I have checked the content type ID and it is not referencing my custom content type,
    but for some reason the list is using that content type.
    I remember seeing this same issue a few months ago while creating a SP2010 sandbox solution. It could well be something I'm doing wrong when creating the lists/content type.
    Steps to recreate this issue:
    Create a SharePoint hosted app in VS
    Create some custom fields
    Create a custom content type
    Create a list based on that content type
    Create another list not based on the content type
    Delete feature that VS creates for the second list and add the list def and instance to the main feature (containing the other list and content type)
    Deploy and go to second list, note that it has the custom fields from the first list.
    Any advice on what to do about this would be great. I have tried deleting the list and recreating it in VS several times but that didn't work.
    Thanks
    David

    Hi
    I have now tested against a trail Office  365 Developer site and I had to make a few adjustments
    - change the url
    - change the target to SharePoint Onlne
    - change the url 
    I still wasn't happy so I created a new SharePoint Hosted app and pointed at the above developer site.  I copied my CrossDomainExec.js and stripped all my code except my CopyItemInSameLIbrary method which hasn't changed since I created this post. 
    - changed the App Manifest permissions to Web -full Control ( was previously tenant)
    I still got errors which is really painful as you don't even see the POST request in Fiddler
    The URL used for my POST is as follows ( note host URL is fictitious)
    "https://myapphell-547d8061d39e38.sharepoint.com/sites/appsdev/RESTTestSHA/_api/SP.AppContextSite(@target)/web/Getfilebyserverrelativeurl('/sites/appsdev/Shared Documents/SrcDoc.docx')/copyTo(strNewUrl='/sites/appsdev/Shared Documents/DestDoc.docx', bOverWrite=true)?@target='https://myapphell.sharepoint.com/sites/appsdev'" String
    Ran the app a second time and now I see......Wow it WORKS!!!!!! ..Can't be true can it?
    .... next I will switch the target url to my on prem farm to see if this still works so watch this space!
    Daniel
    Freelance consultant

  • Upgrade SharePoint Content Types / Site Columns declaratively in SharePoint hosted apps

    Hi!
    I have a question where I was unable to find any official guidance for. I have created a SharePoint hosted APP where I have multiple site columns and content types (declared in XML). The APP installs and functions just fine. 
    Now I have a requirement to change a site column (Choice field, just add some more choice values). I was able to update the site column but the changes will not be reflected on the list column (I think because there no way to push the changes).
    So is there an "official" way of changing site columns?
    Any help is appreciated!
    Thx!

    msdn -
    How to: Update app web components in SharePoint 2013 :
    We do not support changing the data type of a list or content type field (column) after its initial deployment in any
    circumstance. In particular, do not change the data type of a field as part of an app update (not
    even programmatically). As an alternative, you can add a new field. If the app includes custom item create, edit,
    or view forms; be sure to make corresponding changes in these forms. For example, add UI for the new field and remove UI for the old one. (In a provider-hosted app, you can programmatically move data from the old field to the new one and then delete the old.
    How to: Update apps for SharePoint
    [custom.development]

  • Error when trying to retrieve Document Library in Sharepoint Hosted App using REST

    I have created the following REST request in order to retrieve the root folder of a Document Library added to a Sharepoint Hosted App
    getProductDocumentFolder: function () {
    $.ajax({
    url: _spPageContextInfo.webServerRelativeUrl +
    "/_api/web/GetFolderByServerRelativeUrl('/Lists/ProductDocuments')",
    type: "GET",
    headers: {
    "accept": "application/json;odata=verbose",
    success: function () {
    alert("Success!");
    //REST.Operator.readAll();
    error: function (err) {
    alert("Oops, error!");
    alert(JSON.stringify(err));
    The Document Library was added to the App from the Add > New Item menu in Visual Studio. I selected List and Selected Document Library from the Create a customizable list... dialog. The list is defined as shown in the picture below.
    I get the generic error "Value does not fall within the excepted range".
    I have tried both 
    "/_api/web/GetFolderByServerRelativeUrl('/Lists/ProductDocuments')"
    and
    "/_api/web/GetFolderByServerRelativeUrl('/ProductDocuments')"
    for the Document Library URL both I get the same error in both cases.
    What am I missing here?

    Problem solved. 
    It turns out there should be NO leading '/' in the relative URL despite the example shown in http://msdn.microsoft.com/en-us/library/office/dn292553.aspx#Folders with "/Shared Folder".
    The correct GetFolderByServerRelativeUrl-parameter in my case is 'Lists/Productdocuments'.
    Unsure whether example is wrong or if it applies to other cases than mine.

Maybe you are looking for

  • JDBC Receiver channel

    Hi, I have a receiver channel of JDBC type. The database configured in this channel is installed on a different net from XI. Is this a problem? I have seen an error connection of this type: Error during database connection to the database URL 'jdbc:o

  • Launching Difficulty, DVDSP trying to find purposely deleted file

    I recently deleted some .mov files from my external drive to free some space. Since then, I have been unable to work in DVDSP because as soon as it launches, a window pops up that reads, "Searching for movie data in file "Horses_1". When I push the p

  • TABLE TRANSPORT PROBLEM

    i am in a real fix, i want to know the proper way of transpoprting table entries from dev server to q/a, prod i came across 2 ways first way se11 => ztable. menu => transport entries assign it to a req no. check in se09 /10 release. (i am giving the

  • Not compatible JSF 1.2

    we are migrating from JSF1.1 to JSF1.2(the version comes with WLS10.3). Now when the application is deployed it doesn't have any problem in loading the page, but on submission of the form it keeps popping this error , Illegal Syntax for Set Operation

  • Certification Question Issue

    Hi, I am having this specific project and I know this setup is not supported. Can you help me verify. I am checking with Oracle Certification Matrix but since this is Oracle Forms 6 and Reports 6, it is no longer there. Server Specs: Intel Xeon CPU 3