ahaenggli / AzureAD-LDAP-wrapper

LDAP-Wrapper for 'microsoft 365' work or school accounts/users (former 'office 365' - via Entra ID, former AzureAD without AADDS)
https://ahaenggli.github.io/AzureAD-LDAP-wrapper/
MIT License
121 stars 30 forks source link

filter for onPremises #55

Closed Net-Felix closed 1 year ago

Net-Felix commented 1 year ago

Hi,

I've tried to filter against onPremisesSamAccountName but i get the following error:

ERROR: 2023-06-19T08:28:43.858Z:  graph.fetch.js callApi error with {
  endpoint: "https://graph.microsoft.com/beta/users?$select=businessPhones,displayName,givenName,jobTitle,mail,mobilePhone,officeLocation,preferredLanguage,surname,userPrincipalName,id,identities,userType,externalUserState,onPremisesSamAccountName,customSecurityAttributes&$filter=onPremisesSamAccountName ne ''&$count=true",
  opts: {},
  error: 'Request failed with status code 400'
}

according to microsoft i need an additional header: https://learn.microsoft.com/en-us/graph/aad-advanced-queries?tabs=http i've manually added the header in graph.fetch.js:

fetch.callApi = async function (endpoint, accessToken, opts = {}, skipError = true) {

    const options = {
        headers: {
            Authorization: `Bearer ${accessToken}`,
            ConsistencyLevel: 'eventual'
        }
    };
....

but still the same error :(

ahaenggli commented 1 year ago

An empty filter value seems not to be supported by "ne". You can use this site build/test the endpoint url: https://developer.microsoft.com/en-us/graph/graph-explorer

ahaenggli commented 1 year ago

I have made a few small adjustments. The advanced filters should now be supported without any changes to the code. Furthermore, the error of the Graph API should also be output. It is available in the Docker DEV tag now. I hope this helps with troubleshooting :)

ahaenggli commented 1 year ago

The fixes are now available in the latest version :)