Credential |
Get al credentials for person and child
Namespace: Gamanet.C4.SDK
Assembly: Gamanet.C4.SimpleClient (in Gamanet.C4.SimpleClient.dll) Version: 2026.0.0.733
Syntax
C#
public ISimpleCollection<CredentialV1> GetAllForPersonChildren( Guid personId )
Parameters
- personId Guid
- preson identifier.
Return Value
ISimpleCollection<CredentialV1>Credentials
Implements
ISimpleClientCredentialRepositoryV3.GetAllForPersonChildren(Guid)Example
The following example illustrates how the SimpleClient provides credential type by Id
C#
using System; using Gamanet.C4.SDK; using Gamanet.C4.SimpleInterfaces; public class Example { static void Main() { // Create instance of simple client var client = new SimpleClient(ConnectorConfiguration.HttpClient); ConnectionInfoV1 token; // Connect to local server var connectionResult = client.Connect(new Uri("https://localhost/"), "Support", "support", out token); if (connectionResult != ConnectionResult.Successful) { Console.WriteLine("Connection unsuccessful, result: {0}", connectionResult); return; } Console.WriteLine("Connection result: {0}", connectionResult); Console.WriteLine(); // Create new instance of SimplePerson as an Example Company var exampleCompany = new SimplePersonV1( Guid.NewGuid(), EntityRoot.Person, PersonCategory.Company); exampleCompany.Data["Surname"] = "exampleCompany"; // Create new instance of SimplePerson as an Example Department var exampleDepartment = new SimplePersonV1( Guid.NewGuid(), exampleCompany.Id, PersonCategory.Department); exampleDepartment.Data["Surname"] = "exampleDepartment"; // Create new Example Person var examplePerson = new SimplePersonV1( Guid.NewGuid(), exampleDepartment.Id, PersonCategory.Person); examplePerson.Data["Surname"] = "examplePerson"; client.Persons.Create(exampleCompany); client.Persons.Create(exampleDepartment); client.Persons.Create(examplePerson); // You have to install package for credential type first // Create example credential data var exampleCard = new CredentialV1(Guid.NewGuid(), exampleCredentialTypeId) // CredentialCategory.Card { Code = "0x457", Name = "ExampleCard", OwnerId = EntityRoot.Person, HolderId = exampleDepartment.Id, // Undefined holder for example purposes Status = CredentialStatus.Enabled }; // Create credential in database client.Credentials.Create(exampleCard); var exampleResult = client.Credentials.GetAllForPersonChildren(exampleCompany.Id); foreach (var credential in exampleResult) { Console.WriteLine($"{credential.Name}->{credential.HolderId}"); } // Disconnect from server client.Disconnect(); } }
See Also