Interview Questions administrator

Best SharePoint administrator Interview Questions and Answers with topic wise:


Recycle Bin | MMS | ManagedVsCrawledProperties |
Showing posts with label SharePoint hosted apps. Show all posts
Showing posts with label SharePoint hosted apps. Show all posts

Thursday, January 10, 2013

Get Host Web Url in SharePoint 2013/Office365 apps using JSOM

Get HostWeb URL through JavaScript object model:

Just do copy/paste the below code and execute it.



Note: The below shared code is 100% verified/executed.

Please reach the below post URL to get the hostweb url through REST service
http://sharepointquicksolutions.blogspot.com/2016/12/get-sharepoint-host-web-url-using-rest.html 

Appmanifest.xml:

Set read level permisisons to the web

Default.aspx:

<p id="getHostWebURL"> </p>

App.js

'use strict';
var hostweburl, appweburl;
var website;

$(document).ready(function () {
    appweburl = window.location.protocol + "//" + window.location.host + _spPageContextInfo.webServerRelativeUrl;
    hostweburl = _spPageContextInfo.siteAbsoluteUrl;

    //hostweburl = decodeURIComponent(getQueryStringParameter("SPHostUrl"));
    //appweburl = decodeURIComponent(getQueryStringParameter("SPAppWebUrl"));
    var scriptbase = hostweburl + "/_layouts/15/";

    $.getScript(scriptbase + "SP.Runtime.js",
        function () {
            $.getScript(scriptbase + "SP.js", retrieveListItems);
        }
    );
});

// Function to retrieve a query string value.
// For production purposes you may want to use
// a library to handle the query string.
function getQueryStringParameter(paramToRetrieve) {
    var params =
        document.URL.split("?")[1].split("&");
    var strParams = "";
    for (var i = 0; i < params.length; i = i + 1) {
        var singleParam = params[i].split("=");
        if (singleParam[0] == paramToRetrieve)
            return singleParam[1];
    }
}

function retrieveListItems() {
    var context = new SP.ClientContext(appweburl);
    var appContextSite = new SP.AppContextSite(context, hostweburl);
    website = appContextSite.get_web();
    context.load(website);
    context.executeQueryAsync(onGetWebSuccess, onGetWebFail);

    //the remaining code is omitted for clarity  
}

function onGetWebSuccess() {
    alert("calling" + website.get_title());
    $('#getHostWebURL').text("The title of the host web of this app is " + website.get_title());
}

function onGetWebFail(sender, args) {
    alert('Failed to get lists. Error:' + args.get_message());
}

Wednesday, January 2, 2013

Error occurred in deployment step 'Uninstall app for SharePoint":

I am facing the below issues regularly while deploying the SharePoint hosted apps to both either office 365 sites or SharePoint sites from the visual studio. So guys, please help me on it.

 Error occurred in deployment step 'Uninstall app for SharePoint': Only users who can View Pages can list Apps.
Error occurred in deployment step 'Uninstall app for SharePoint': The underlying connection was closed: An unexpected error occurred on a receive.
Error occurred in deployment step 'Uninstall app for SharePoint': The underlying connection was closed: A connection that was expected to be kept alive was closed by the server.
Error occurred in deployment step 'Uninstall app for SharePoint': Communication with the SharePoint server is canceled.

Tuesday, December 18, 2012

SharePoint hosted vs Cloud hosted apps


Difference between SharePoint hosted apps and cloud hosted apps?
An app for SharePoint can have both SharePoint-hosted and cloud-hosted components. The app does not (actually cannot) contain custom code that executes on the SharePoint servers, administrators are assured of its safety.

Cloud hosted:  
  1. This type of hosting is used when app has at least one remote component. It may also include SharePoint hosted components. There are two types in Cloud hosted apps.
  2. The external components [also called Remote components] are persisted in databases, servers, or cloud-based services that are external to the SharePoint farm.
  3. Cloud-Hosted Apps are also referred to as server-side apps.
  4. Cloud-Hosted SharePoint 2013 Apps include components hosted outside your SharePoint farm. Such components can be hosted on IIS servers, Apache servers, or cloud services such as Windows Azure.
  5. When it is required exactly is if we require server-side components in apps. In such situations, you must write a Cloud-Hosted App. Also known as server-side apps.