REST Service API executor.executeAsync Call Ends in Failure Function in Sharepoint Hosted App

Any Answers Will Help me to Forward and Gain Knowledge in SharePoint Development

While i am Trying to get the list Items Using Rest API Calls in SharePoint Hosted App Using Below Function

function loadingSamples()  {     var JobListName = "RRR Jobs #";     var executor;     // Initialize the RequestExecutor with the app web URL.     executor = new SP.RequestExecutor("/");      //Fetching the choice values from the Job Status Field, to show in the Dropdown field     executor.executeAsync     ({         url: "/_api/web/lists/getbytitle('" + encodeURIComponent(JobListName) + "')/fields/getbytitle('Job Status')?$  select=Choices",         method: "GET",         headers: { "Accept": "application/json; odata=verbose" },         success: successHandlerStatus,         error: errorHandler     }); } function successHandlerStatus(data)  {     alert("sucesss") }  function errorHandler(data, errorCode, errorMessage)  {     alert("errorMessage") } 

It’s always going to error function named errorHandler With Error Code as -1002 and Error Message as Bad Request and Inside Data -> Body , the Error message is

{     "error":{            "code":"-1,Microsoft.SharePoint.Client.InvalidClientQueryException",         "message":{             "lang":"en-US",             "value":"The expression \"web/lists/getbytitle('DWR Jobs \" is not valid."         }     } } 

Note :

  • This is working code in Sharepoint Hosted App that previously hosted in another Windows server.

  • Now i hosted this App in New windows server,it’s successfully hosted but it gives above mentioned Error in Rest Service Call.

How we can render the same parent top global navigation bar in SharePoint Hosted app On-Premise 2019

I need to render the same parent top global navigation bar in the **SharePoint Hosted app On-Premise 2019 **.

  • I have already included a master page link in the default.aspx page in SharePoint Hosted app.

<%@ Page Inherits=”Microsoft.SharePoint.WebPartPages.WebPartPage, Microsoft.SharePoint, Version=15.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c” MasterPageFile=”~site/_catalogs/masterpage/Sampleapp.master” Language=”C#” %>

  • Parent Site

enter image description here

  • SharePoint Hosted App

enter image description here

Cannot inherit parent navigation in app web from parent site – SharePoint hosted add in for SharePoint 2019

I am trying to inherit the top link navigation from parent site in my SharePoint Hosted Add-in.

However, I’m just getting link of the app itself in the navigation pane in App web.

I’m using SharePoint 2019 and developed add-in using Visual Studio.

Any help is much appreciated!

Pulling data from multiple excel files hosted on Sharepoint

I have a load of excel files (consistent format, but with different content) that I would like to pull data from into one master file. All source files are saved on Sharepoint in one folder, and the destination file is also to be saved on Sharepoint.

I would like the master file to pull given fields from all files saved in the folder, without having to specify all of the file names.

I managed to get this working with Power Query for files just saved on my hard drive, but not sure the best way to achieve this same end on Sharepoint (using this method, for reference). Really nice solution but doesn’t seem to be so simple via the cloud.

Thanks!

Sharepoint online/365 integration (Upload files) on React app hosted on Azure and WebApi C# .Net Core 2.2

I’m struggling since some weeks ago trying to interact/automate a way to upload files from a Web App created in React and upload files to a Sharepoint Online Site – in a specific folder. The WebApp is hosted in Azure and using a C# .Net Core 2.2 as backend.

I’m trying to using some kind of REST API that help me out with this task (Could be on React in frontend, or in C# Core or C# MS FW .Net for backend) I’m searching across internet a way to do it but all the testings were failed.

Someone can give me some insight, tip or advice on how to achieve this?

I’m trying:

  • Use code from Microsoft WebPage (Using jQuery).

  • Using PnP, but on my localhost I receive a CORS problem (I’m trying using Client ID and Secret ID to interact with Sharepoint).

Connect to MS Graph from Sharepoint App (SP Hosted Addin)

I have a Sharepoint App (A standalone Sharepoint Hosted App, not to be confused with a SPFx web part) and I want to be able to make calls to MS Graph.

I created a simple web page on local host (redirect Uri same as base url) that could connect to Graph with HTML, CSS and Javascript (code base for Sharepoint App) and that works really well (using the graph javascript SDK).

So I figured if I just moved the code into the App it should work. Unfortunately it does not. Its most likely to do with the fact that the Sharepoint App runs in a subweb of the site that it is installed in. When I click the button that prompts the connection to Graph, the actual Sharepoint App page refreshes and I am left with a blank popup box (usually where the users credentials are verified), the address in this popup is “about:blank”.

The app Registration settings are correct as they work with the simple web page sample. (is there a change required to the Manifest?)

I have tried many different values as the redirect Uri, ie:

  • login.microsoftonline.com/[tenant-id]
  • base url of the sharepoint app – https://[domain]-[appid].sharepoint.com
  • base url of the site https://[domain].sharepoint.com
 [HTML]      <script type="text/javascript" src="https://secure.aadcdn.microsoftonline-p.com/lib/1.0.2/js/msal.js">lt;/scriptgt;     <script type="text/javascript" src="https://cdn.jsdelivr.net/npm/@microsoft/microsoft-graph-client/lib/graph-js-sdk.js"></script>  [JAVASCRIPT]  let client;  const msgraphinit = async () => {      const scopes = ["User.Read", "Group.Read.All"];      const msalConfig = {         auth: {             clientId: Secrets.clientId,             redirectUri: Secrets.redirectUri,         },     };      var msalApplication = new Msal.UserAgentApplication(msalConfig);     const msalOptions = new MicrosoftGraph.MSALAuthenticationProviderOptions(scopes);     const msalProvider = new MicrosoftGraph.ImplicitMSALAuthenticationProvider(msalApplication, msalOptions);      client = MicrosoftGraph.Client.initWithMiddleware({         debugLogging: true,         authProvider: msalProvider,     });  };  $  (function () {      $  ("#getdets").click(function () {          request.getUserDetails()             .then((res) => {                 console.log('SUCCESS');                 console.log(res);                 ui.updateOutput(res);             })             .catch((error) => {                 console.log('ERROR');                 console.log(error);                 ui.updateOutput(error);             });     });  });  const Secrets = {     clientId: "populated-from-sp-list-value",     redirectUri: "populated-from-sp-list-value", };  let request = {      getUserDetails: async () => {         try {             let res = await client.api("/me").get();             return res;         } catch (error) {             throw error;         }     }, }  let ui = {      updateOutput: (res) => {         document.getElementById("graphoutput").innerHTML = JSON.stringify(res);     }, }; 

At the moment I am just trying to get the connection working so im using the most basic Graph endpoint as proof of concept.

Any advice would be greatly appreciated.

Cheers

Greg J