Connect to sharepoint web service with javascript


http://appsrv/pfa/_api/ProjectData/Projects?$select=ProjectName,ProjectStartDate,ProjectPercentCompleted

This is the link that after you enter username and password return XML data, I need to access that link and authenticate and receive data with JavaScript.

How can I do that?

Routing a file via Drop Off Library using CSOM


I have CSOM code that uploads a file to a specific directory in my site.

Now I want it to route the file via Drop Off Library,

I tried to place the file in Drop Off Library but it is not working
(my content organizer works for adding a document but is not working for my code)

Link to document library images from SharePoint Online App?


I’ve created a simple employee photo directory app for SharePoint Online (O365), packaged and deployed the solution as a SharePoint app. The lists and libraries where I’m getting my data from exist under my primary domain: https://company.sharepoint.com

My app is deployed under the a sub domain and site similar to the following: https://company-3ijdksk13.sharepoint.com/myapp/

I’m using JSOM and the cross-domain libraries to pull various data in from various lists and this works perfectly. Now I want to embed some images in my app that exist in a document library on the primary site: https://company.sharepoint.com/SomeImages/0001.png

If I directly link to the images in my markup from my app, most of the time the images load, every once in a while, they do not. When they fail, I’ve found that to get them to load, the user has to manually navigate to the primary domain which re-authenticates them or something and they will load fine when they go back into my app. Since this app will be bookmarked on users desktops, they will not always visit the primary site first.

Question: what is the best way to display images in my SharePoint App that exist on my primary site? Surely there is an easier way that manually retrieving the image data via REST or JSOM and dealing with that mess?

Access List on Sub-site of Host Web (using a Provider Hosted App)


When creating a provider hosted app/add-in, how would you access a list located on a sub-site of the page it was installed on? I can access lists at the top-level of the Host web using the below syntax, but can’t figure out the syntax to get any other lists from the Host web that have been created in sub-sites of the Host web. No matter how I alter the path’s, I can’t get it to bring in these lists, just constant 404 errors.

// To get list information from the top-level
var getQueryStringParameter = function (p) {
                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] == p)
                        return singleParam[1];
                }
            };

            var hostweburl;
            var appweburl;

            // Load the required SharePoint libraries
            $(document).ready(function () {
                //Get the URI decoded URLs.
                hostweburl = decodeURIComponent(getQueryStringParameter("SPHostUrl"));
                appweburl = decodeURIComponent(getQueryStringParameter("SPAppWebUrl"));

                // resources are in URLs in the form:
                // web_url/_layouts/15/resource
                var scriptbase = hostweburl + "/_layouts/15/";

                // Load the js files and continue to the successHandler
                $.getScript(scriptbase + "SP.RequestExecutor.js", execCrossDomainRequest);
            });

            function execCrossDomainRequest() {
                var executor = new SP.RequestExecutor(appweburl);
                executor.executeAsync(
                    {
                        url: appweburl + "/_api/SP.AppContextSite(@target)/web/lists/getbytitle('Goals')/items?@target='" + hostweburl + "'",
                        method: "GET",
                        headers: { "Accept": "application/json; odata=nometadata" },
                        success: retrievedGoalsList,
                        error: errorGettingGoalsList
                    }
                );

                // Success function
                function retrievedGoalsList(data) {
                    // This returns list information successfully if list is in the Host web
                }

                // Error function
                function errorGettingGoalsList(err) {
                    console.log("Async call failed with error: ", err);
                }                
            }

Adding an app makes page blank IE8


Some of the clients’ for our SharePoint system still have to use IE8 as their browser.

I have created a new page(.aspx) as the old one got corrupted. However, on my new site when I add the “Discussion Board” app to the page the entire screen goes blank only in IE8.

Chrome, Firefox and later versions of IE run the app with no issues.

Curiously, the old version of the page (.aspx) ran the app with no problems.

Is there something I am missing?

Maintain app id


I am developing an SharePoint Add-in (ex. app) from Visual Studio targeting Office 365.
I’ve registered this app in Azure AD (there is app!) and on ReplyUrl I’ve wrote the url obtained when I first debug this app

https://mytenant-7fc76d95b16303.sharepoint.com/MyOutlookCalendar/Pages/Default.aspx

Worked fine a couple of times then VS changed that ID of my app and it’s not recognized anymore by Azure AD.
I can add this new url to Reply Url but I don’t think this is a solution.
Sometimes I can’t change it in Azure AD and I am forced to delete the app and configure it again.
Any ideas how to work with this kind of projects ?

how to add a missing app ( Site title configuration)?


I am trying to add the “Site Title Configuration” app to my app library. but it is not on my app store and I do not know how to activate it. I appreciate if someone can help me.

Can't add custom javascript and list alert to my custom form


I have created a custom list using Visual Studio in SharePoint app. Then, I have created a custom edit form for it.

It is working fine, but when I try to add a new custom javascript file in that custom form, it’s not loading. Even the list alert function isn’t working in that custom form.

Could any one please give me suggestions so that I can customize the form?

Install app using JSOM in SharePoint Online


We have requirement that SharePoint hosted app need to add/remove in site when site creation(Site has been created using JSOM). I did’t find any article regarding add app programmatically using JSOM.

My app is in appcatalog. I need to add it in site when site provisioning. usually we will do using UI [Site -> Site Content -> Add an app].

Is this possible in JSOM? or can i achieve this in any other way?

SharePoint Online: Navigation showing all Site Collections and Sites?


I’m attempting to make some sort of listing of all of the site collections in a SharePoint Online/Office 365 instance, and then have all of the sites/webs in each site collection be listed below them.

I’m coming from a SharePoint 2013 background, so my usual strategy of making a farm-scoped Webpart won’t work here.

Right now I have some App code that uses ClientContext and Tenants to get everything (using logic from here), but from my understanding Apps are always in iframes, which wouldn’t work well for displaying this information.

Is there a way to call server-side code from a page layout or some other way without using iframes in SharePoint Online?

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