我使用下面的代码来查找 Department 中的用户:
string searhString="IT Admin Onsite";
var departmentPeoples = await graphServiceClient.Users.Request().Filter($"department eq '{searchString}'").Select(u => new {
u.DisplayName,
u.MobilePhone,
u.BusinessPhones,
u.UserPrincipalName
}).GetAsync();
Run Code Online (Sandbox Code Playgroud)
但是,我想搜索包含的所有部门,因此我的搜索字符串将是
字符串 searchhString="管理员";
我尝试过startswith,但是只有当给定示例代码中我的searchString 是“IT”时,这才有效。如何完成这个任务?
请帮忙。
我使用下面的代码来查找部门名称:
GraphServiceClient graphServiceClient = connectToGraphAPI(Globals.adTenantId, Globals.adClientId, Globals.adClientSecret);
var Peoples = await graphServiceClient.Users[userid].People.Request().GetAsync();
foreach (Person People in Peoples) {
if (People.DisplayName != null && People.DisplayName.Equals(userName)) {
return People.Department.ToString();
}
}
Run Code Online (Sandbox Code Playgroud)
但是,我想获取组织中所有部门的列表,而不是查找特定用户的部门。
我有以下课程:
public static class AllAcess
{
public static int var1;
//Some conditional statements
if(somecondition)
{
var1 = x;
}
else
{
var1 = y;
}
}
Run Code Online (Sandbox Code Playgroud)
我怎样才能在课堂上放一些条件语句。目前它不允许 if ,else 等。
请建议可以在此处用作条件的逻辑。
我想从其他类访问 var1。