C# CS1061 Error with ‘.Request’ (Trying to update users in an Azure AD B2C through external app)

I have been struggling with a CS1061 error for ‘.Request()’ and cannot seem to figure it out, if anyone can think of a solution or a work around it would be greatly appreciated!

The program is running .NET 8 and using Microsoft.graph, microsoft.graph.core and Azure.Identity packages, all up to date.

 static void UpdateUser()
 {
     var scopes = new[] { "https://graph.microsoft.com/.default" };

     var tenantId = "...";


     var clientId = "...";
     var clientSecret = "...";

     ClientSecretCredential clientSecretCredential = new ClientSecretCredential(tenantId, clientId, clientSecret);
     var graphClient = new GraphServiceClient(clientSecretCredential, scopes);

     Console.WriteLine("Updating a user...");

     Console.Write("Enter the Object ID of the user to update: ");
     string objectId = Console.ReadLine();

     try
     {

         var user = graphClient.Users[objectId].GetAsync().Result;

         // Display current user attributes
         Console.WriteLine($"Current attributes of the user with Object ID {objectId}:");
         Console.WriteLine($"Display Name: {user.DisplayName}");
         Console.WriteLine($"Given Name: {user.GivenName}");
         Console.WriteLine($"Surname: {user.Surname}");
         Console.WriteLine($"Email Address: {user.Identities[0].IssuerAssignedId}"); 
         Console.WriteLine($"Business Phone Number: {user.BusinessPhones?[0]}"); 

         // Prompt the user to update attributes
         Console.WriteLine("Enter new values for the user's attributes (press Enter to keep current value):");

         Console.Write("New Display Name: ");
         string newDisplayName = Console.ReadLine();

         Console.Write("New Given Name: ");
         string newGivenName = Console.ReadLine();

         Console.Write("New Surname: ");
         string newSurname = Console.ReadLine();

         Console.Write("New Email Address: ");
         string newEmailAddress = Console.ReadLine();

         Console.Write("New Business Phone Number: ");
         string newBusinessPhone = Console.ReadLine();

         // Update user attributes
         if (!string.IsNullOrEmpty(newDisplayName))
             user.DisplayName = newDisplayName;

         if (!string.IsNullOrEmpty(newGivenName))
             user.GivenName = newGivenName;

         if (!string.IsNullOrEmpty(newSurname))
             user.Surname = newSurname;

         if (!string.IsNullOrEmpty(newEmailAddress))
             user.Identities[0].IssuerAssignedId = newEmailAddress;

         if (!string.IsNullOrEmpty(newBusinessPhone))
         {
             if (user.BusinessPhones == null)
                 user.BusinessPhones = new List<string>();

             user.BusinessPhones.Clear(); 
             user.BusinessPhones.Add(newBusinessPhone); 
         }

         // Update the user in Azure AD B2C
         graphClient.Users[objectId].Request().UpdateAsync(user).Wait();
         Console.WriteLine("User updated successfully");
     }
     catch (Exception ex)
     {
         Console.WriteLine($"Error updating user: {ex.Message}");
     }
 }

Hopefully this information is suffice, if there is any other info I can provide that may help feel free to ask (I am fairly new to coding so good chance I have missed something!).

Thanks in advance.

I have tried rebuild and cleaning the program, I also asked chatGPT if it has any ideas why this may not work, but it could not provide a fix. All packages have been updated.

New contributor

Prime Capybara is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.

Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa Dịch vụ tổ chức sự kiện 5 sao Thông tin về chúng tôi Dịch vụ sinh nhật bé trai Dịch vụ sinh nhật bé gái Sự kiện trọn gói Các tiết mục giải trí Dịch vụ bổ trợ Tiệc cưới sang trọng Dịch vụ khai trương Tư vấn tổ chức sự kiện Hình ảnh sự kiện Cập nhật tin tức Liên hệ ngay Thuê chú hề chuyên nghiệp Tiệc tất niên cho công ty Trang trí tiệc cuối năm Tiệc tất niên độc đáo Sinh nhật bé Hải Đăng Sinh nhật đáng yêu bé Khánh Vân Sinh nhật sang trọng Bích Ngân Tiệc sinh nhật bé Thanh Trang Dịch vụ ông già Noel Xiếc thú vui nhộn Biểu diễn xiếc quay đĩa Dịch vụ tổ chức tiệc uy tín Khám phá dịch vụ của chúng tôi Tiệc sinh nhật cho bé trai Trang trí tiệc cho bé gái Gói sự kiện chuyên nghiệp Chương trình giải trí hấp dẫn Dịch vụ hỗ trợ sự kiện Trang trí tiệc cưới đẹp Khởi đầu thành công với khai trương Chuyên gia tư vấn sự kiện Xem ảnh các sự kiện đẹp Tin mới về sự kiện Kết nối với đội ngũ chuyên gia Chú hề vui nhộn cho tiệc sinh nhật Ý tưởng tiệc cuối năm Tất niên độc đáo Trang trí tiệc hiện đại Tổ chức sinh nhật cho Hải Đăng Sinh nhật độc quyền Khánh Vân Phong cách tiệc Bích Ngân Trang trí tiệc bé Thanh Trang Thuê dịch vụ ông già Noel chuyên nghiệp Xem xiếc khỉ đặc sắc Xiếc quay đĩa thú vị
Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa
Thiết kế website Thiết kế website Thiết kế website Cách kháng tài khoản quảng cáo Mua bán Fanpage Facebook Dịch vụ SEO Tổ chức sinh nhật