How to access Employee Id from Azure AD using Microsoft graph - azure-ad-graph-api

At first I want to mentioned I did search for the answer but I did not get the concrete answer. So here I am asking again.
I am using MVC.net project and using Microsoft graph to get informaiton from Azure AD. I am trying to get EmployeeId along with DisplayName. For the scope I am using 'user.readbasic.all
With below query I am getting DiplayName for all the users but for EmployeeID I am getting null. Except for myself.
"https://graph.microsoft.com/v1.0/users?$select=DisplayName,EmployeeId";
When I use "me" then again get the EmployeeID.
"https://graph.microsoft.com/v1.0/me?$select=DisplayName,EmployeeId";
So using the user.readbasic.all I do get employee id but for myself but why not for others

This is due to for others Employee ID has not been set.
Example: Employee ID has not been set for a user ,so it is showing null.
Let me Set an employee ID for a user.
Now I am testing for with same API I am getting my EmployeeID value.
In below Picture you can see as I have set EID for Rahul Only and for others it is showing null.

Related

Purview API to show the contact names

I am only getting the Ids of contacts, owners, createdby and updatedby fields. Which API to use to get the corresponding names?
"contacts":{"Expert": [{"id": "aa874e20-85bd-4e63-a11d-ce715e2a85bb"}],"Steward": [{"id":aa874e20-85bd-4e63-a11d-ce715e2a85bb"}]}
i am only getting the Ids of contacts, owners, createdby and updatedby
fields. Which API to use to get the corresponding names?
Thank you #Sindhuja Laxmipuram posting your suggestion here as community wiki to beneficial for other community members for similar issue.
You can use the below command to list the contact or owner name for
the above.
GET {Endpoint}/catalog/api/atlas/v2/entity/guid/{guid}?minExtInfo={minExtInfo}&ignoreRelationships={ignoreRelationships}
For more information please refer this SO THREAD | How to use REST API to extract role assignment information from a Azure Purview account .

Smartsheet - Get id of the row creator

I need to get the creator id, but request with include=writerInfo returns only email. The problem is that the user email can be changed and createdBy will change but modifiedAt will not change. Thus, I will need to get a list of users each time to determine the createdBy id of the row.
Is there a way to get the createdBy id when receiving a sheet with rows?
According to what I'm seeing in the API docs, I don't believe it's possible to get userId at the row level in the results of a Get Sheet request.

How to get the product catalog associated to a product set

Creating a product set requires associating a product_catalog_id:
POST https://graph.facebook.com/<API_VERSION>/<PRODUCT_CATALOG_ID>/product_sets
Reading an product set having the Facebook id is easy:
GET https://graph.facebook.com/<API_VERSION>/<PRODUCT_SET_ID>
Unfortunately, the response for that request contains 3 fields (id, name and filter).
How can I get the product_catalog_id associated to a product set (if I know the product_set_id)?
PS: The documentation does not help with that: https://developers.facebook.com/docs/marketing-api/dynamic-product-ads/product-catalog#productset
The catalog ID is not a field of the product set, so you therefore cannot traverse the graph in this way.
The only way to gather this associated is to read read the catalogues in a business, and their product sets to find the correct association unfortunately.

Get list of courses with username in moodle programmatically from database

I need to get the list of all courses available with their username who created it in moodle site programmatically from database. As I am using drupal with moodle. In drupal I connected the moodle database so I need to fetch the courses with username for further development. Please help me on this.
Regards
Neha Singhania
The only place where you can find out who created a course is in the mdl_log table. Look for an entry with module = course and action is something like 'create' (I haven't got the code in front of me right now to check). The 'course' field will match the id of the mdl_course table, where you can find the course name (fullname / shortname). The user field will match the id of the mdl_user table, where you can find the firstname, lastname and username for the user.

How to handle entity versions in SQL Server?

I have a SQL Server 2008 R2 database that contains a table that holds my entities from an ad.
It looks something like this :
Title
Price
CreatedDate
UpdatedDate
Description
EndDate
PublishedDate
StateOfProduct
Id
UserId
UserLocationId
Visits
CategoryId
TypeOfAd
AdminComment
ReviewedDate
AmountOfImages
UserPostCode
UserEmail
UserPhoneNr
UserPassword
OwnerType
AdminUserId
InactivatedDate
OldPrice
PriceLastChange
An Ad entity can have the following stages : Published, Waiting for review, Outdated.
Say that the ad is published and the customer decides to edit the ad, this means that the settings on the ad above will change. A change like this demands a new review and that means that the ad will go from Published to Waiting for review.
The problem with this is that when a ad is changed and is waiting for review it is not published anymore.
What I need is to let the ad be published with the old (reviewed) data and when the review is done of the updated ad it will switch places but keep the old id.
The question is how to handle this the right way?
I Suppose that I could have two identical tables to keep record count down and to make it simpler to find published ads but it will be a lot more work to use Entity Framework against two identical tables at the same time.
Another solution might be to add two extra columns in the Ads table that holds the version of the ad and the original adId. The flow will in this case be something like this :
Create Ad(id=1), originalId = null, version = null.
Review Ad(id=1)
Publish Ad(id=1), version = 1
Customer Updates Ad, new Ad(id=2) is created with version set to null(=waiting for review) and originalId = 1
Reviewed Ad(id=2) done, Ad(id=1) will be copied to a new records (id = 3 (or2)), originalId set to 1. Ad(id=2) will be moved/copied to Ad(id1), originalId = null, version = 2.
The ad table might however be vary large with this but it will be a lot easier to trace ads history.
I believe this could be done using many approaches, it's just a matter of preference. What I would do is make a new table named, say, ReviewedAds with int Id, int AdId, bit Reviewed. 1:many relationship with Ads table so AdId from this table is a foreign key and matches Id from Ads table. Then I would display only those ads whose Reviewed bit is set to '1'. Two records in ReviewedAds couldn't have the same AdId and Reviewed bit set to '1'.