I have created below code to get Users from XML:
string userName = "user";
string password = "password";
string uri = @"uri";
WebClient webClient = new WebClient();
webClient.Credentials = new NetworkCredential(userName, password);
Stream stream = webClient.OpenRead(uri);
XElement output = XElement.Load(stream);
IEnumerable<XElement> users = from el in output.Elements() select el;
foreach (XElement str in users)
{
Console.WriteLine(str);
}
Result:
<User>
<ObjectId>3cbde</ObjectId>
<Alias>alias</Alias>
<DisplayName>Display Name</DisplayName>
<TimeZone>0</TimeZone>
<Language>0</Language>
<ListInDirectory>false</ListInDirectory>
<IsVmEnrolled>true</IsVmEnrolled>
</User>
Now I would like to insert the data into database, but I would like to put each field as separate column - table in database has columns: ObjectId, DisplayName, TimeZone and etc. Could you please give me some advices how it can be easily done? Do I need to convert it into DataTable or else?