Giter Club home page Giter Club logo

sharepoint_provider-hosted_add-ins_tutorials's Introduction

A Series of Visual Studio Solutions to Accompany the MSDN Tutorial Series about Provider-hosted Add-ins

SharePoint add-in model is considered as a legacy option for extending SharePoint user interface. Please see SharePoint Framework documentation and the SharePoint Framework samples for the future proven option to extend SharePoint Online. Possible backend services should be using Azure Active Directly based registration and related app models.

This repository is a series of provider-hosted SharePoint Add-in samples that are used with the tutorial series that begins with Get started creating provider-hosted SharePoint Add-ins.

None of the samples in this repository contain Sharepoint-hosted SharePoint Add-ins. For information about the differences between the two types of SharePoint Add-ins, see SharePoint Add-ins.

Applies to

  • SharePoint Online and on-premise SharePoint 2013 and later

Prerequisites

We recommend that you read the MSDN article SharePoint Add-ins.


Overview

This set of samples tracts the series of tutorials that begin at Get started creating provider-hosted SharePoint Add-ins. Each tutorial adds to the sample SharePoint add-in, Chain Store. This series of samples preserves the state of the add-in's Visual Studio solution after each tutorial. Before beginning any tutorial, you can open the corresponding sample solution in Visual Studio and follow along. For example, to follow the tutorial Give the add-in the SharePoint look-and-feel, open the BeforeSharePointUI.sln file in Visual Studio.

The following are the tutorial articles and the corresponding sample solutions:

To the the complete Chain Store add-in, open FinalChainStoreAdd-in.sln

To use these samples

  1. Open Visual Studio as an administrator.
  2. Open the .sln file for the solution you need.
  3. In Solution Explorer, highlight the SharePoint add-in project and replace the Site URL property with the URL of your SharePoint developer site.
  4. If your test SharePoint developer site is an on premises SharePoint 2013, open the AppManifest.xml file and change the SharePointMinVersion value to "15.0.0.0".
  5. The samples assume that Visual Studio is using Version 12 (SQL 2014) of SQL Express. If you have SQL Server 2016 installed on your development computer, you need to make a change to the web.config file in the solution. Find the line that sets the SqlAzureConnectionString near the top of the file. Change the phrase "ProjectsV12" in the value to "ProjectsV13". You will need to do this for each of the solutions in the repo.
  6. Follow the instructions in the corresponding tutorial to add functionality to the add-in and test it.

Known issues

If you get a System.Data.SqlClient.SqlException after pressing F5 to start one of the solutions, this may be caused by having a more recent version of SQL Server installed on your development computer. For the fix, see the section above To use these samples.

Questions and comments

We'd love to get your feedback on this set of samples. You can send your questions and suggestions to us in the Issues section of this repository.

# Additional resources

Copyright

Copyright (c) Microsoft. All rights reserved.

This project has adopted the Microsoft Open Source Code of Conduct. For more information, see the Code of Conduct FAQ or contact [email protected] with any additional questions or comments.

sharepoint_provider-hosted_add-ins_tutorials's People

Contributors

davidchesnut avatar rick-kirkham avatar vesajuvonen avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

sharepoint_provider-hosted_add-ins_tutorials's Issues

spContext was null System.NullReferenceException and "Object reference not set to an instance of an object"

Hello,
I am running SharePoint Online developer site as my tenant and using Visual Studio 2019 as a development environment.
I am learning SharePoint development and reached till the page "Include an add-in part in the provider-hosted add-in".

I am stuck with the error of having spContext was null. It seems that I get this error almost everywhere. However I tried to overcome this error by adding the code
if spContext == null { spContext = SharePointContextProvider.Current.GetSharePointContext(Context); } else { spContext = Session["SPContext"] as SharePointContext; }

But at this stage I am not able to pass this error, kindly help.

image

Thank you and
Regards

Access Denied when launching final solution add-in

Getting an "Access denied. You do not have permission to perform this action or access this resource" when launching the FinalChainStoreAdd-in solution. Error seems to be originating from Line 119 in SharePointComponentDeployer.cs

Exception Details: Microsoft.SharePoint.Client.ServerUnauthorizedAccessException: Access denied. You do not have permission to perform this action or access this resource.

Source Error: 


Line 117:                webScopedEmployeeAction.DeleteObject();
Line 118:
Line 119:                clientContext.ExecuteQuery();
Line 120:            }
Line 121:        }

Source File: C:\DevSamples\SharePoint_Provider-hosted_Add-ins_Tutorials\9_FinalChainStoreAdd-in\ChainStoreWeb\Utilities\SharePointComponentDeployer.cs    Line: 119 

connectionString does not function with latest SQL Server release (SQL Sever 2016)

With the release of SQL Server 2016, the SSDT db instance is "(localdb)\ProjectsV13". However, connectionString in the web.config file of the ChainStoreWeb project points towards "(localdb)\ProjectsV12". Therefore if the latest SQL Server release is installed, an exception of type 'System.Data.SqlClient.SqlException' occurs when establishing a connection to SQL Server.

Therefore, in my opinion, so that this project functions 'out-of-the-box' using the current articles, the connectionStrings should be updated to V13

@Rick-Kirkham if you agree with this suggestion, I don't mind updating the queryString in each solution. I would like to save future users the bit of debugging that I did.

Not working for SP 2013 / Visual Studio 2015

I downloaded to my server,
Windows 2012 R2

"The required version of SharePoint Foundation or SharePoint Server is not installed on this system. The target version of the SharePoint project is 16.1. ChainStore 0

How to start this DB? What prereqs do we need?

Win 2012 R2, VS 2017.
I have local on-premise SharePoint 2013 with MSSQL 2008 R2 (this on-prem is stopped, I use SharePoint Online url in Project Settings.)

Did You use VS2017 with no additional developer tools?

2018-08-09_225542

Unable to do a Response.Redirect in Debug mode on Local

I notice a Response.Redirect in the solution as an example to a list in the host tenant using:
// Go back to the Local Employees page
Response.Redirect(spContext.SPHostUrl.ToString() + "Lists/Local%20Employees/AllItems.aspx", true);

I desire to navigate from the OrderForm.aspx page to CorporateDataViewer.aspx page while in Debug mode on my local. Desired placement for the redirect is at the end of the btnCreateOrder_Click method right after the CreateOrder(txtBoxSupplier.Text, txtBoxItemName.Text, quantity); call verses clicking "BACK" browser button twice as stated in the tutorial instructions.

I used Response.Redirect("CorporateDataViewer.aspx", false); and received the error notice "An error occurred while processing your request." from the CorporateDataViewer Page_PreInit.

I think the context has been lost at the OrderForm.aspx page so I read that the redirect needs some assistance from the TokenHelper.

Response.Redirect(TokenHelper.GetAppContextTokenRequestUrl(spContext.SPAppWebUrl.ToString(), Server.UrlEncode("Page/CorporateDataViewer.aspx")));

When I try the redirect above the SPAppWebUrl is null form the SharePointContext.cs using:

// SPAppWebUrl
string spAppWebUrlString = TokenHelper.EnsureTrailingSlash(httpRequest.QueryString[SharePointContext.SPAppWebUrlKey]);
Uri spAppWebUrl;
if (!Uri.TryCreate(spAppWebUrlString, UriKind.Absolute, out spAppWebUrl) ||
!(spAppWebUrl.Scheme == Uri.UriSchemeHttp || spAppWebUrl.Scheme == Uri.UriSchemeHttps))
{
spAppWebUrl = null;
}

How do I get the SPAppWebUrl? Is this the direction to pursue for the redirect to CorporateDataViewer.aspx page?

Please help, thank you!

(on-premise) SP.UI.Controls.Navigation seems bugged.

Hi,

I am currently testing your tutorial/guideline on my on-premise SP 2013 Enterpise Server (with CU January 2016).
It seems that my Ribbon/Chrome control is somehow bugged.
I tested it in different browsers from IE, Edge to FireFox.
capture
As you see in the image above the icon of the question mark is not displayed correctly. Furthermore I don't have a background change and right border when I hover/click the icon. That's a diffrent behaviour compared to the 'official' ribbon.
untitled

Last but not least I can't close the dropdown window when I click on an empty page area.
I don't get any script errors...

Is this a bug or normal? Can anyone guide me in a direction for a fix. I can't debug that minified SP.UI.Controls.js.

thaxy

Error This project references NuGet package(s) that are missing on this computer

I am getting below error while debugging solution 1_BeforeSharePointUI

Severity Code Description Project File Line Suppression State
Error This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is ..\packages\Microsoft.CodeDom.Providers.DotNetCompilerPlatform.1.0.0\build\Microsoft.CodeDom.Providers.DotNetCompilerPlatform.props. ChainStoreWeb C:\Users\Administrator\Desktop\SharePoint_Provider-hosted_Add-ins_Tutorials-master\SharePoint_Provider-hosted_Add-ins_Tutorials-master\1_BeforeSharePointUI\ChainStoreWeb\ChainStoreWeb.csproj 229

can anyone help me with this.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.