Sharepoint-hosted app: Access site columns belonging to host site


I have a sharepoint-hosted app containing a custom list. On the host site collection where I am deploying this app, there are several custom site columns.

In my app, I want to access these site columns and include as columns in my custom list.

Is this possible?

SP2013 Cannot access admin pages of installed Apps from App Store – 403 Forbidden


We have a newly deployed on-premise SharePoint 2013 farm…

In one of our web applications, after we install any app from the SharePoint store and add it to a web site, we cannot access the administrative page of the app.

It is strange, because the app installs just fine. And we have no problem adding it to the site. But when we browse to the application (from Site Contents) we get a 403 – Forbidden.

The web app is using claims authentication.

Any thoughts?

How to search list app part as is built in on actual list?


When I navigate to my list, I have all functionality…my views are available and my search is, too. However, when I embed it in a page as an app part, that functionality disappears.

How can I fix this — why is it not available?

What I want
This is what I want
What I get
This is what I get from the app part

Is it possible to formate the date by Calculated Value property?


I created a field in list as DOB (Date and Time type). I want to display DOB in the format of ‘1 Oct 2013‘.How can i achive this.Is it possible to do by Calculated Value property?

GetPropertiesFor ajax call from Sharepoint 2013 app


I tried the below code with GetMyProperties in a SharePoint Hosted app and it works, but the following code gives me a bad request

    url = appweburl +
    "/_api/SP.UserProfiles.PeopleManager/GetPropertiesFor(accountName=@v)?@v='domainuser'"
     method: "GET",
     headers: { "Accept": "application/json; odata=verbose" },
     success: successHandler,
     error: errorHandler

But it gives me a bad request… Please help me

Moving document from user mysite to another user mysite in Sharepoint 2013 App


I am creating Sharepoint 2013 app having requirement as mentioned below:

  • Users in my site select document and can send it to another user.
  • When user select a document in mysite and sent it to another user, that document needs to be copied to another user’s mysite.
  • I can use REST API OR CSOM(Client object model) to do so…

    Step 1 is already achieved, I create ribbon button and on click i am giving people picker which can allow user to select another user to share.
    I am also getting my site url(Personal URL) of another user but whenever i am trying to copy to another user mysite document library it is not allowing me to copy as cross domain

Below is code snippet for copying file. I am able to move to same site but on another user mysite copyto function is not working.

function copyfiletoanotherusermysite() {

context = new SP.ClientContext(appwebUrl);
factory = new SP.ProxyWebRequestExecutorFactory(appwebUrl);
context.set_webRequestExecutorFactory(factory);
appContextSite = new SP.AppContextSite(context, hostwebUrl);
var web = appContextSite.get_web();

var notifyId;
// Get Selected List & Item
var currentLib = web.get_lists().getById(sourcelistid);
var selectedItems = itemid;
var count = CountDictionary(selectedItems);

currentItem = currentLib.getItemById(selectedItems);
context.load(currentItem, 'FileLeafRef');

var _destinationlibUrl = SelectUserPersonalUrl + '/Destination' + '/' + docname;
var File = currentItem.get_file();
context.load(File);

if (File != null) {
    alert(_destinationlibUrl);
    File.copyTo(_destinationlibUrl, true);

}

context.executeQueryAsync(function (sender, args) {
    notifyId = SP.UI.Notify.addNotification('Moving file...to      ' + _destinationlibUrl, true);
    //alert(notifyId);
},

function (sender, args) {
alert(‘Error occured’ + args.get_message());
}
);
}

File.copyTo() function is working for same site domain but throwing error for another user mysite copying.

We can also use REST API instead of Client object model

Please help me to resolve this.

Thanks,

Paras Sanghani

Missing Apps, SharePoint 2013


I would be very grateful if someone could answer a question for me. I would like to add several (built-in) apps like External Lists and Promoted links to my SharePoint 2013 Site collection. The issue is, when I select “Add an App” only a few apps appear in my site collection.

If I perform the same action under the Central Admin site I do have those apps available. My question is, how do I make all the apps available in a site collection other than Central Admin.

Thanks

SharePoint Apps – Can we have multiple Client Webpart in a sharePoint app?


Can we have multiple Client Webpart in a sharePoint app? If so, do we need to do any configurations?

SharePoint Apps – What is App catalog?


What is SharePoint Application catalog? and where do we use this?

Get all subsites of top level site using JavaScript OM


I am trying to get all sub sites of the top level site. However, the code I wrote for the app returns zero subsites. I am a little mystified as to why:

var context = SP.ClientContext.get_current();
var user = context.get_web().get_currentUser();
var web = context.get_web();
var lists = web.get_lists();

// this is used later to hold the sub webs found
var webCollection = null;

function getSubWebs(){
    webCollection = web.getSubwebsForCurrentUser(null);
    context.load(webCollection)
    context.executeQueryAsync(onGetSubwebsSuccess, onGetSubwebsFail);
    log("executing getSubWebs query");
}

function onGetSubwebsSuccess(sender, args){
    log("getSubWebs query successful")
    alert("Number of sites: " + webCollection.get_count());
    var selectSubwebsBox = $("#selectsubwebs");
    var webEnumerator = webCollection.getEnumerator();
    //clearSubWebList();

    while (webEnumerator.moveNext()){
        var web = webEnumerator.get_current();

        log("Adding " + web.get_title + " to the subwebs list.")
        selectSubwebsBox.append($("<option>", { value: web.get_title })).text(web.get_title);
    }
}

function onGetSubwebsFail(sender, args){
    log("getSubWebs query failed")
    alert("Request to retrieve subwebs failed. Error: " + args.get_message())
}

function clearSubWebList(){
    $("#selectsubwebs").find("option").remove();
    log("SubWebsList cleared");
}

function log(msg){
    // not all browser support console/logging
    if (window.console){
        window.console.log(msg);
    }
}

Why is the SharePoint Javascript OM methods returning zero subsites? Is this not the correct way to do this?

Question and Answer is proudly powered by WordPress.
Theme "The Fundamentals of Graphic Design" by Arjuna
Icons by FamFamFam