0

For an Outlook Add-In I created a Blacklist in a XML File. Now I need to save the words which are in my Blacklist in an string array to create a if-else condition. This is what I tried but it doesn't work...

private string[] XMLReader() 
            {
                string[] arr = XDocument.Load(@"C:\ProjektOutlook\outlookadresses\Add-In\Add-In\Resources\Blacklist.xml").Descendants("attachmentRefs")
                            .Select(Name => Name.Value).ToArray();


                return arr;
            }

This is what my XML File looks like:

<?xml version="1.0" encoding="utf-8" ?>
<blacklist>
<attachmentRefs>
<attachmentRef Name="Anhang" />
<attachmentRef Name="anhang" />
<attachmentRef Name="Anlage" />
<attachmentRef Name="anlage" />
<attachmentRef Name="Angefügt" />
<attachmentRef Name="angefügt" />
<attachmentRef Name="Anahng" />
<attachmentRef Name="angehängt" />
<attachmentRef Name="Angehängt" />
<attachmentRef Name="angehangen" />
<attachmentRef Name="Angehangen" />
<attachmentRef Name="anahng" />
<attachmentRef Name="Analge" />
<attachmentRef Name="analge" />
<attachmentRef Name="Anliegend" />
<attachmentRef Name="anliegend" />
<attachmentRef Name="Beigefügt" />
<attachmentRef Name="beigefügt" />
<attachmentRef Name="beiliegend" />
<attachmentRef Name="Beiliegend" />
<attachmentRef Name="hinzugefügt" />
<attachmentRef Name="Datei" />
<attachmentRef Name="Dokument" />
<attachmentRef Name="Beischrift" />
<attachmentRef Name="Ergänzung" />
<attachmentRef Name="Nachtrag" />
<attachmentRef Name="Zusatz" />
<attachmentRef Name="Beilage" />
<attachmentRef Name="Addendum" />
</attachmentRefs>
</blacklist>
Eugene Astafiev
  • 47,483
  • 3
  • 24
  • 45
Sophia
  • 63
  • 4

0 Answers0