Quantcast
Channel: Microsoft Identity Manager forum
Viewing all articles
Browse latest Browse all 7443

Need some help with reading XML and storing values in Dictionary/List

$
0
0

Hi All,

I'm new to C# and new to programming in general and although I'm ok at powershell, I have never worked with XML so this is a bit of a mystery topic for me.

I'm keeping some data about the group, its domain and some user attribute values in a structure shown below, in an XML file that I can read on the Initialise() method of the MA Extensions code.

<Groups><Group><GroupName samaccountname="FGPP-USA" Domain="usa.iam.net"><AccountType>01</AccountType><AccountType>02</AccountType><AccountType>03</AccountType></GroupName></Group><Group><GroupName samaccountname="FGPP-UK" Domain="uklondon.iam.net"><AccountType>04</AccountType><AccountType>05</AccountType><AccountType>06</AccountType></GroupName></Group><Group><GroupName samaccountname="FGPP-ROOT1" Domain="iam.net"><AccountType>07</AccountType><AccountType>08</AccountType><AccountType>09</AccountType></GroupName></Group><Group><GroupName samaccountname="FGPP-ROOT2" Domain="iam.net"><AccountType>01</AccountType><AccountType>02</AccountType><AccountType>03</AccountType><AccountType>04</AccountType></GroupName></Group></Groups>

So I have an single AD Forest consisting of some domains. I have a few groups per domain which I want FIM Sync to update memberships in. Using one management agent I'm reading groups and person into metaverse. I project all users from AD as persons to metaverse. However, when it comes to groups, I want to use the ShouldProjectToMV method in the import flow code to only project if a group has a samaccountname value and domain value matching with something in the XML (eg. <GroupName samaccountname="FGPP-ROOT2" Domain="iam.net">)

The next thing I want to do is get a list of AccountType values as a list that I can foreach with and find the person objects in metaverse and write to a custom mv attribute called memberSTR [multivalue string]. However, where I need help is some LINQ XML type. I would ideally want a function I can call from within MapAttributesForImport() which uses LINQ XML and returns me a list of AccountTypes for a specific Group for a specific domain.

I will have about 100 such groups so even though this would take a performance hit as FIM will have to calculate memberships for every group, its still OK.

So my question is

1. How do I get a list of all groups with samaccountname and domains from that XML?

2. If I know the samaccountname and domain of a group, how can I get the respective AccountType values from that XML?

I posted this question somewhere else and the gentleman was very helpful but they proposed a solution which is not suitable. I know the management will give me some more groups in future for FIM to update memberships. So there will be more additions to XML, however, I don't think the structure will change much.

Please help!


Viewing all articles
Browse latest Browse all 7443

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>