open-networks / go-msgraph Goto Github PK
View Code? Open in Web Editor NEWGolang implementation of the Microsoft Graph API
License: MIT License
Golang implementation of the Microsoft Graph API
License: MIT License
The unit tests for the function UpdateUser
in User.go
is missing.
OData/MSGraph offers advanced query parameters to
$filter
$search
$select
in GET or GETALL requests which would be nice to use e.g. to search for groups by name if you don't want to force your users to lookup ObjectIDs ๐
Furthermore if one adds optional query arguments it would be nice to allow to pass a context.Context
to cancel requests.
I will provide a PR to further discuss how to allow optional query parameters
When using the below code, groups returns with all of the expected information, but groupMembers returns with only the object ID and all other fields are empty. I can confirm in azure portal that the object IDs are correct, and we get one empty object per group member, but no data.
graphClient, err := msgraph.NewGraphClient(tenantID, clientID, clientSecret)
if err != nil {
fmt.Println("Credentials are probably wrong or system time is not synced: ", err)
}
groups, err := graphClient.ListGroups()
if err != nil {
fmt.Println("Error", err)
}
groupMembers, err:= groups[0].ListMembers()
if err != nil {
fmt.Println("Error", err)
}
json.NewEncoder(res).Encode(groupMembers)
The response from ListMembers() looks like this:
[ {"id":"99f2f82b-08f8-4054-b4c8-458698aaa861","businessPhones":[],"displayName":"","givenName":"","mail":"","mobilePhone":"","preferredLanguage":"","surname":"","userPrincipalName":""},{"id":"cb53abcc-47e3-4843-b9c4-5f93f247f1ca","businessPhones":[],"displayName":"","givenName":"","mail":"","mobilePhone":"","preferredLanguage":"","surname":"","userPrincipalName":""} ]
How can we return a list of members for a group using msgraph?
The documentation to delete a user and enable a user account is missing.
The existing api assumes that the client application has permission to act without user delegation. In my application, the library is used behind an oauth2 proxy. The proxy does the oauth2 dance and passes back a header with the negotiated token. In this context, I need to use the token the proxy has negotiated and not have the client library refresh the token.
Steps to recreate:
Observed behavior:
Client can't "refresh" token because its permission scope is not user.read.all
Is your feature request related to a problem? Please describe.
Yes. When I go to connect the client I am receiving:
AADSTS900382: Confidential Client is not supported in Cross Cloud request
I am using the Azure government cloud, which has a login url of "https://login.microsoftonline.us" and a base url of "https://graph.microsoft.us"
Describe the solution you'd like
I would like to be able to pass in an option to the client creation that includes those urls
Describe alternatives you've considered
To make it backward compatible then add ... option objects with a SetBaseUrl() and SetLoginUrl() methods to stay api consisten
The network connection is sometimes bad in my area to connect to Graph API endpoint. How to use a proxy like Golang builtin http.Client
in the graphClient?
graphClient, err := msgraph.NewGraphClient(tenantId, clientId, clientSecret)
err := graphClient.MakePUTAPICall(url, nil, fileBytes, &res) <---- timeout error
if err != nil {
panic(err)
}
Is your feature request related to a problem? Please describe.
When using the ListMembers
function of Group
only direct members are returned and nested groups are omitted completely.
This way there's no way to get members of nested groups at all because you don't get the nested groups and there's no recurse option.
Describe the solution you'd like
By adding a generic recurse
option every List
function could at least consider if recursion can be implemented for this very call.
In case of Group.ListMembers
it could optionally recurse nested groups and return also these users.
Alternatively a more generic API could be considered:
Instead of returning (Users. error)
e.g. a new Group.MemberNodes(...) (Nodes, error)
function could be added.
Given the following context:
type NodeType string
const (
NodeTypeGroup NodeType = "#microsoft.graph.group"
NodeTypeUser NodeType = "#microsoft.graph.user"
)
type Node interface {
GetType() NodeType
GetID() string
GetDisplayName() string
GetMail() string
// ... further common attributes?
}
type Nodes []Node
func (n Nodes) Users() Users {
// ...
}
func (n Nodes) Groups() Groups {
// ...
}
User
and Group
can both implement the Node
interface and can be returned as part of the Nodes
response.
Afterwards checking either the NodeType
or the .(type)
of the struct allows filtering for users and handle nested groups without a recursion option.
Of course a breaking change to ListMembers
of Group
would also be possible.
I'd be happy to provide a PR as soon as a design decision has been made about if and how to implement this ๐
Hi all,
in the readme I find the followings:
events, err := graphClient.ListCalendarView("[email protected]", startTime, endTime)
but in the source code I can't find the method.
Is it missing of just not implemented yet?
Is there a way to get the calendar items of a specific user?
Is your feature request related to a problem? Please describe.
Please add the jobTitle to the user struct
Describe the solution you'd like
Please add the jobTitle to the user struct
Describe alternatives you've considered
N/A
Additional context
Just need to be able to read and write the jobTitle
Hello everyone ๐
Vincent here from the Microsoft Graph SDKs team. I'm reaching out to announce we're working on an official Go SDK, we haven't announced the community preview yet as there are still a number of things we need to work through, but I though I'd reach out to give you an opportunity to provide feedback before anybody else!
A few benefits from this new SDK:
As with every pre-previews, we have a list of known limitations we're working through.
We'd love for you to pop by the repos under our org, give it a try, and give us feedback on your experience with this new SDK.
Is your feature request related to a problem? Please describe.
CreateUser is a part of the User API for MS Graph that is unimplemented.
Describe the solution you'd like
Implement the CreateUser method
The use of a different MS Graph API endpoint than the global
endpoint has been introduced with #9 and pull-request #11.
There are multiple msgraph API endpoints currently available, see https://docs.microsoft.com/en-us/azure/active-directory/develop/authentication-national-cloud#azure-ad-authentication-endpoints.
When LoginBaseURL
and BaseURL
from constants.go
, this is a package setting. Maybe someone wants to use two different MS Graph API endpoints at the same time --> move from package-variable to GraphClient variable.
Can you please tag a version 0.1.1 with the latest changes?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.