Independentsoft
- any library, any programming language
Home
Purchase
Support
Company
Contact
Graph .NET
>
Tutorial
> Get followed sites
List the sites that have been followed by the specified in user.
C# example
using System; using System.Threading.Tasks; using System.Collections.Generic; using Independentsoft.Graph; using Independentsoft.Graph.Sites; namespace ConsoleApp1 { class Program { static async Task Main() { try { GraphClient client = new GraphClient(); client.ClientId = "63333333-209e-454e-b7bd-55a4d201270f"; client.Tenant = "independentsoft.onmicrosoft.com"; client.ClientSecret = "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"; IList
sites = await client.GetFollowedSites("info@independentsoft.onmicrosoft.com"); foreach (Site site in sites) { Console.WriteLine("Id: " + site.Id); Console.WriteLine("DisplayName: " + site.DisplayName); Console.WriteLine("WebUrl: " + site.WebUrl); Console.WriteLine("-----------------------------------------------------------------"); } Console.Read(); } catch (GraphException ex) { Console.WriteLine("Error: " + ex.Code); Console.WriteLine("Message: " + ex.Message); Console.Read(); } } } }
VB example
Imports System Imports System.Threading.Tasks Imports System.Collections.Generic Imports Independentsoft.Graph Imports Independentsoft.Graph.Sites Namespace Sample Class Module1 Shared Sub Main(ByVal args As String()) Dim task = New Task(AddressOf Run) ' Start and wait for task to end. task.Start() Console.Read() End Sub Shared Async Sub Run() Try Dim client As GraphClient = New GraphClient() client.ClientId = "63333333-209e-454e-b7bd-55a4d201270f" client.Tenant = "independentsoft.onmicrosoft.com" client.ClientSecret = "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" Dim sites As IList(Of Site) = Await client.GetFollowedSites("info@independentsoft.onmicrosoft.com") For Each site As Site In sites Console.WriteLine("Id: " & site.Id) Console.WriteLine("DisplayName: " & site.DisplayName) Console.WriteLine("WebUrl: " & site.WebUrl) Console.WriteLine("---------------------------------------") Next Console.ReadLine() Catch ex As GraphException Console.WriteLine("Error: " + ex.Code) Console.WriteLine("Error: " + ex.Message) Console.Read() End Try End Sub End Class End Namespace
Need help? Ask our developers:
Name*
Email*
Message*