Security News
Opengrep Emerges as Open Source Alternative Amid Semgrep Licensing Controversy
Opengrep forks Semgrep to preserve open source SAST in response to controversial licensing changes.
github.com/open-networks/go-msgraph
go-msgraph
is an incomplete go lang implementation of the Microsoft Graph API. See Overview of Microsoft Graph
This implementation has been written to get various user, group and calendar details out of a Microsoft Azure Active Directory and create / update the same.
This code was created as part of a software project developed by Open Networks GmbH, Austria (the one in Europe :wink:) in the year 2017. The company has been bought by Bechtle AG, Germany in 2021 and the software project is planned to be replaced by end of 2022. Furthermore, the employee mainly working on this project also left the company by April 2022 and may only contribute in his leisure time.
Back in the days, there was no official support from Microsoft for Go lang. This support has been added in 2021, see Issue #25.
Therefore, I strongly advise you to use the new official implementation from Microsoft at Golang MSGraph SDK by Microsoft.
working & tested:
$select
, $search
and $filter
when querying datacontext
-aware API calls, can be cancelled.planned:
To get your credentials to access the Microsoft Graph API visit: Register an application with Azure AD and create a service principal
More examples can be found at the docs. Here's a brief summary of some of the most common API-queries, ready to copy'n'paste:
// initialize GraphClient manually
graphClient, err := msgraph.NewGraphClient("<TenantID>", "<ApplicationID>", "<ClientSecret>")
if err != nil {
fmt.Println("Credentials are probably wrong or system time is not synced: ", err)
}
// List all users
users, err := graphClient.ListUsers()
// Gets all the detailled information about a user identified by it's ID or userPrincipalName
user, err := graphClient.GetUser("humpty@contoso.com")
// List all groups
groups, err := graphClient.ListGroups()
// List all members of a group.
groupMembers, err := groups[0].ListMembers()
// Lists all Calendars of a user
calendars, err := user.ListCalendars()
// Let all full-day calendar events that are loaded from ms graph be set to timezone Europe/Vienna:
// Standard is time.Local
msgraph.FullDayEventTimeZone, _ = time.LoadLocation("Europe/Vienna")
// Lists all CalendarEvents of the given userPrincipalName/ID that starts/ends within the the next 7 days
startTime := time.Now()
endTime := time.Now().Add(time.Hour * 24 * 7)
events, err := graphClient.ListCalendarView("alice@contoso.com", startTime, endTime)
This project uses Semantic versioning with all tags prefixed with a v
. Altough currently the case, I cannot promise to really keep everything backwards compatible for the 0.x version. If a 1.x version of this repository is ever released with enough API-calls implemented, I will keep this promise for sure. Any Breaking changes will be marked as such in the release notes of each release.
I recommend to use go modules and always use the latest tagged release. You may directly download the source code there, but the preffered way to install and update is with go get
:
# Initially install
go get github.com/open-networks/go-msgraph
# Update
go get -u github.com/open-networks/go-msgraph
go mod tidy
There is some example code placed in the docs/ folder. The code itself is pretty well documented with comments, hence see http://godoc.org/github.com/open-networks/go-msgraph or run:
godoc github.com/open-networks/go-msgraph
FAQs
Unknown package
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Opengrep forks Semgrep to preserve open source SAST in response to controversial licensing changes.
Security News
Critics call the Node.js EOL CVE a misuse of the system, sparking debate over CVE standards and the growing noise in vulnerability databases.
Security News
cURL and Go security teams are publicly rejecting CVSS as flawed for assessing vulnerabilities and are calling for more accurate, context-aware approaches.