Bibliography / References: How to update CurrentList

Hannah212 1 Reputation point
2021-12-01T09:10:13.977+00:00

Hello All,
I need to programmatically update the CurrentList of References in Word.
I don't want to add new entries, but update existing entries by changing only single values in the source XML. The tag remains the same.

My code looks like this:

this.Application.LoadMasterList("Sources.xml");

List<string> currentTags = new List<string>();

foreach (Source currSource in this.Application.ActiveDocument.Bibliography.Sources)
{
    currentTags.Add(currSource.Tag);
}

foreach (Source masterSource in Application.Bibliography.Sources)
{
    if (currentTags.Contains(masterSource.Tag))
        {
            this.Application.ActiveDocument.Bibliography.Sources.Add(masterSource.XML);
    }
}

The problem now is, that the masterSource.XML can not be added to the current List, because there is already an entry with the same tag.
What I want to do is update this entry with the new entry from the MasterList.

my Source XML looks like this:

<b:Source>
    <b:Tag>Some_Tag</b:Tag>
    <b:SourceType>Book</b:SourceType>
    <b:Guid>{XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX}</b:Guid>
    <b:Title>Template Reference</b:Title>
    <b:StandardNumber>Document Number: A-B1234-00000-XX</b:StandardNumber>
    <b:Edition>Revision: X</b:Edition>
</b:Source>

The only value that changes is the Editition Value, which I want to update in the CurrentList.
I also tried to delete the source in the CurrentList, which is not possible because there are Citations referencing the source.

Thank you for your Help!

Office Development
Office Development
Office: A suite of Microsoft productivity software that supports common business tasks, including word processing, email, presentations, and data management and analysis.Development: The process of researching, productizing, and refining new or existing technologies.
3,459 questions
Word Management
Word Management
Word: A family of Microsoft word processing software products for creating web, email, and print documents.Management: The act or process of organizing, handling, directing or controlling something.
891 questions
0 comments No comments
{count} votes