0

I'm reading our Google-Apps-User like this:

UsersResource.ListRequest userrequest = service.Users.List();
userrequest.MaxResults = 250;
userrequest.Customer = "xxxxxxx";
IList<User> gusers = userrequest.Execute().UsersValue;
foreach (var guser in gusers) { .... }

No problem so far, I get what I want except the CustomSchema fields. In the API-Explorer it's easy to set "projection" to "full" and everythin is fine, but in the C#-Code I don't get it how to do it.

If I try this:

userrequest.Projection = "FULL";

I get this hint:

UserResource.ListRequest.ProjectionEnum? ListRequest.Projection

I know for a true coder is this the solution, but I don't get it. What do I have to write to get the projection to "full"? Even in the source code from Google it's just the string (okay, I'm quite new to .Net-coding maybe I miss a lot here)

/// <summary>Restrict information returned to a set of selected fields.  </summary>
    [Google.Apis.Util.RequestParameterAttribute("projection", Google.Apis.Util.RequestParameterType.Query)]
    public virtual System.Nullable<ProjectionEnum> Projection { get; set; }

    /// <summary>Restrict information returned to a set of selected fields.</summary>
    public enum ProjectionEnum
    {
        /// <summary>Includes only the basic metadata fields (e.g., deviceId, serialNumber, status, and
        /// user)</summary>
        [Google.Apis.Util.StringValueAttribute("BASIC")]
        BASIC,
        /// <summary>Includes all metadata fields</summary>
        [Google.Apis.Util.StringValueAttribute("FULL")]
        FULL,
    }
  • `userrequest.Projection = ProjectionEnum.FULL;` – stuartd Sep 01 '16 at 09:40
  • Thx for the fast response! When I see I understand - quite easy, good lesson! ;o) Strange is, that I get now "...is not in current context" (translation from the german message) for the ProjectionEnum despite the fact that Google.Apis.Util and Google.Apis.Util.Store are used. Another little hint? – Mathias Behr Sep 01 '16 at 11:02
  • Got it!!! Has to be: userrequest.Projection = Google.Apis.Admin.Directory.directory_v1.UsersResource.ListRequest.ProjectionEnum.Full; No idea why it's not reachable otherwise... – Mathias Behr Sep 01 '16 at 11:10

1 Answers1

0

Got it!!! Has to be:

userrequest.Projection = Google.Apis.Admin.Directory.directory_v1.UsersResource.ListR‌​equest.ProjectionEnu‌​m.Full; 

No idea why it's not reachable otherwise the directory context is in use anyway.