Click here to Skip to main content
15,887,027 members
Home / Discussions / C#
   

C#

 
GeneralRe: Count DataGridview row values and compare with an Array Pin
Edilson Lemos 20219-Aug-23 14:00
Edilson Lemos 20219-Aug-23 14:00 
GeneralRe: Count DataGridview row values and compare with an Array Pin
Andre Oosthuizen9-Aug-23 21:24
mveAndre Oosthuizen9-Aug-23 21:24 
SuggestionRe: Count DataGridview row values and compare with an Array Pin
Richard Deeming9-Aug-23 21:51
mveRichard Deeming9-Aug-23 21:51 
GeneralRe: Count DataGridview row values and compare with an Array Pin
Edilson Lemos 202110-Aug-23 6:44
Edilson Lemos 202110-Aug-23 6:44 
AnswerRe: Count DataGridview row values and compare with an Array Pin
Edilson Lemos 202110-Aug-23 16:23
Edilson Lemos 202110-Aug-23 16:23 
GeneralRe: Count DataGridview row values and compare with an Array Pin
Andre Oosthuizen10-Aug-23 23:15
mveAndre Oosthuizen10-Aug-23 23:15 
QuestionSharepoint Pin
Kevin Marois7-Aug-23 8:15
professionalKevin Marois7-Aug-23 8:15 
AnswerRe: Sharepoint Pin
Andre Oosthuizen7-Aug-23 23:15
mveAndre Oosthuizen7-Aug-23 23:15 
I did some searching and I trust the following is what you might need going forward -

1) To set up your SharePoint Site, have a look at - MS Support | Create a site in SharePoint[^]

2) SharePoint uses different authentication methods, often involving OAuth tokens or username/password credentials. You'll need to confirm the authentication mechanism that your company uses. Common libraries for handling authentication include Microsoft's MSAL (Microsoft Authentication Library) or ADAL (Active Directory Authentication Library) for OAuth-based authentication. You will find more at - MS Support | With a Mismatch Error | Authentication settings in Central Administration do not match the configuration in web.config[^]
MS Learn | Overview of the Microsoft Authentication Library (MSAL)[^]
MS Azure | Active Directory Authentication Library (ADAL)[^]

3) SharePoint has REST APIs that allow you to interact with it programmatically. Alternatively, there are client libraries provided by Microsoft that can simplify the process of interacting with SharePoint using C#. The Microsoft Graph API is a newer unified API that can also be used to work with SharePoint. See more at - Lists vs. Libraries in SharePoint Online[^]

4) In SharePoint, you have libraries that act like folders. Documents are stored within these libraries.
You can access files using URLs like 'https://your_site.sharepoint.com/sites/your_site_name/your-library-name/your-file-path'.
With APIs, you'll use HTTP requests (GET, PUT, POST, DELETE) to interact with SharePoint. For C#, you can use libraries like HttpClient for making these requests. See more at - MS Support | Work with files in a document library[^]
As a high level example of how you might use 'HttpClient' to read a file from SharePoint using C# -
C#
using System;
using System.Net.Http;
using System.Threading.Tasks;

class Program
{
    static async Task Main(string[] args)
    {
        string url = "https://<your-domain>.sharepoint.com/sites/<site-name>/<library-name>/<file-path>";
        string accessToken = "<your-access-token>";

        using (var client = new HttpClient())
        {
            client.DefaultRequestHeaders.Add("Authorization", $"Bearer {accessToken}");
            HttpResponseMessage response = await client.GetAsync(url);
            if (response.IsSuccessStatusCode)
            {
                string content = await response.Content.ReadAsStringAsync();
                Console.WriteLine(content);
            }
            else
            {
                Console.WriteLine("Error: " + response.StatusCode);
            }
        }
    }
}


Another example can be found at - How to read and write a text file from sharepoint[^]
GeneralRe: Sharepoint Pin
Kevin Marois8-Aug-23 12:22
professionalKevin Marois8-Aug-23 12:22 
GeneralRe: Sharepoint Pin
Andre Oosthuizen8-Aug-23 22:22
mveAndre Oosthuizen8-Aug-23 22:22 
Question.NET 7 C# 8: using new Interface "features" ? Pin
BillWoodruff6-Aug-23 0:54
professionalBillWoodruff6-Aug-23 0:54 
AnswerRe: .NET 7 C# 8: using new Interface "features" ? Pin
Richard Andrew x646-Aug-23 6:14
professionalRichard Andrew x646-Aug-23 6:14 
GeneralRe: .NET 7 C# 8: using new Interface "features" ? Pin
BillWoodruff6-Aug-23 6:29
professionalBillWoodruff6-Aug-23 6:29 
GeneralRe: .NET 7 C# 8: using new Interface "features" ? Pin
trønderen6-Aug-23 10:03
trønderen6-Aug-23 10:03 
GeneralRe: .NET 7 C# 8: using new Interface "features" ? Pin
OriginalGriff6-Aug-23 11:09
mveOriginalGriff6-Aug-23 11:09 
GeneralRe: .NET 7 C# 8: using new Interface "features" ? Pin
Gerry Schmitz6-Aug-23 14:38
mveGerry Schmitz6-Aug-23 14:38 
GeneralRe: .NET 7 C# 8: using new Interface "features" ? Pin
BillWoodruff6-Aug-23 15:38
professionalBillWoodruff6-Aug-23 15:38 
GeneralRe: .NET 7 C# 8: using new Interface "features" ? Pin
harold aptroot6-Aug-23 20:55
harold aptroot6-Aug-23 20:55 
AnswerRe: .NET 7 C# 8: using new Interface "features" ? Pin
Richard Deeming6-Aug-23 22:12
mveRichard Deeming6-Aug-23 22:12 
GeneralRe: .NET 7 C# 8: using new Interface "features" ? Pin
BillWoodruff7-Aug-23 5:58
professionalBillWoodruff7-Aug-23 5:58 
GeneralRe: .NET 7 C# 8: using new Interface "features" ? Pin
Richard Deeming7-Aug-23 21:33
mveRichard Deeming7-Aug-23 21:33 
AnswerRe: .NET 7 C# 8: using new Interface "features" ? Pin
lmoelleb7-Aug-23 1:08
lmoelleb7-Aug-23 1:08 
QuestionRunning a C# class - first attempt Pin
Clive Long 20232-Aug-23 0:16
Clive Long 20232-Aug-23 0:16 
AnswerRe: Running a C# class - first attempt Pin
Richard Deeming2-Aug-23 0:31
mveRichard Deeming2-Aug-23 0:31 
GeneralRe: Running a C# class - first attempt Pin
Clive Long 20232-Aug-23 2:14
Clive Long 20232-Aug-23 2:14 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.