Creating an addin for sharepoint that uses c#

%3CLINGO-SUB%20id%3D%22lingo-sub-771080%22%20slang%3D%22en-US%22%3ECreating%20an%20addin%20for%20sharepoint%20that%20uses%20c%23%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-771080%22%20slang%3D%22en-US%22%3E%3CP%3EHi%20Everyone%2C%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EI%20would%20like%20tp%20create%20an%20addin%20for%20Sharepoint%20online%20which%20uses%26nbsp%3B%20c%23%20code%20and%20libraries.%20I%20am%20following%20the%20tutorial%20mentioned%20in%3A%26nbsp%3B%3CA%20href%3D%22https%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Fsharepoint%2Fdev%2Fsp-add-ins%2Fget-started-creating-sharepoint-hosted-sharepoint-add-ins%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%22%3Ehttps%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Fsharepoint%2Fdev%2Fsp-add-ins%2Fget-started-creating-sharepoint-hosted-sharepoint-add-ins%3C%2FA%3E%3C%2FP%3E%3CP%3EI%20have%20deployed%20the%20addin%20created%20from%20default%20template%20in%20Visual%20Studio%202019%2C%20and%20now%20I%20wish%20to%20include%20and%20execute%20a%20C%23%20file%20for%20generating%20an%20access%20token%20from%20this%20framework.%26nbsp%3B%3C%2FP%3E%3CP%3EI%20am%20confused%20how%20to%20call%20this%20file%20from%20.aspx%20page%20and%20make%20it%20work%20on%20the%20sharepoint%20addin%20page.%20Please%20help.%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-LABS%20id%3D%22lingo-labs-771080%22%20slang%3D%22en-US%22%3E%3CLINGO-LABEL%3EAddin%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3Ec%20sharp%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3EDeveloper%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3Edevelopment%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3Edot%20net%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3ESharePoint%20Online%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E%3CLINGO-SUB%20id%3D%22lingo-sub-772856%22%20slang%3D%22en-US%22%3ERe%3A%20Creating%20an%20addin%20for%20sharepoint%20that%20uses%20c%23%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-772856%22%20slang%3D%22en-US%22%3EYou%20won't%20be%20able%20to%20use%20C%23%20inside%20of%20a%20SharePoint-hosted%20add-in.%20SharePoint%20supports%202%20types%20of%20add-ins%3A%20%22SharePoint-hosted%22%20and%20%22Provider-hosted%22.%20You%20need%20to%20create%20a%20Provider-hosted%20add-in%20to%20be%20able%20to%20use%20C%23%20and%20libraries.%3CBR%20%2F%3E%3CBR%20%2F%3E%3CA%20href%3D%22https%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Fsharepoint%2Fdev%2Fsp-add-ins%2Fget-started-creating-provider-hosted-sharepoint-add-ins%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%20noopener%20noreferrer%22%3Ehttps%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Fsharepoint%2Fdev%2Fsp-add-ins%2Fget-started-creating-provider-hosted-sharepoint-add-ins%3C%2FA%3E%3C%2FLINGO-BODY%3E
Highlighted
New Contributor

Hi Everyone,

 

I would like tp create an addin for Sharepoint online which uses  c# code and libraries. I am following the tutorial mentioned in: https://docs.microsoft.com/en-us/sharepoint/dev/sp-add-ins/get-started-creating-sharepoint-hosted-sh...

I have deployed the addin created from default template in Visual Studio 2019, and now I wish to include and execute a C# file for generating an access token from this framework. 

I am confused how to call this file from .aspx page and make it work on the sharepoint addin page. Please help.

1 Reply
Highlighted
You won't be able to use C# inside of a SharePoint-hosted add-in. SharePoint supports 2 types of add-ins: "SharePoint-hosted" and "Provider-hosted". You need to create a Provider-hosted add-in to be able to use C# and libraries.

https://docs.microsoft.com/en-us/sharepoint/dev/sp-add-ins/get-started-creating-provider-hosted-shar...