[stripped whining]
My current issue is that I am trying to get a list of shapes, and check the tags for each shape and if I find a specific tag, I do something with it.
This worked at one time, and I am not sure what changed to make this no longer work.
What is happening now is that I am getting the following error message while trying to read tag.value: RichApi.Error: GeneralException
.
I have tried multiple different ways to get this data (see below), so the error has been different places. Right now it is showing that the offending statement is var tag = tags.getItem("mc-accessToken");
, but earlier it was at (!tag.isNullObject)
and then await this.replaceExistingDiagram(tag.value);
(on tag.value)
Can someone please direct me to a resource that can help!
My original code was as follows:
await PowerPoint.run(async (context) => {
const presentation = context.presentation;
const slides = presentation.slides.load("items");
await context.sync();
for(let slideIndex = 0; slideIndex < slides.items.length; slideIndex++) {
const slide = slides.items[slideIndex];
const shapes = slide.shapes.load("items");
await context.sync();
for (let shapeIndex = 0; shapeIndex < shapes.items.length; shapeIndex++) {
const shape = shapes.items[shapeIndex];
const tag = shape.tags.getItemOrNullObject(C.TokenSettingName);
if (!tag.isNullObject) {
shape.delete();
await this.replaceExistingDiagram(tag.value);
}
}
}
});
I have made different changes to try and make sure that I am loading the properties I need My current iteration of code looks like this (only showing changes):
const shapes = slide.shapes.load('items');
await context.sync();
for ... {
const shape = shapes.items[shapeIndex];
shape.tags.load("key, value");
await context.sync();
...
}
I have also tried:
const shapes = slide.shapes.load('items, isNullObject');
const tag = shape.tags.getItem(C.TokenSettingName);
shape.load('tags');
shape.load('tags');
const tag = shape.tags.getItem(C.TokenSettingName); tag.load('value');
shapes.load("tags/key, tags/value");
( I just found this: shapes.load("items/$none");
, would I need to do something like shapes.load("items/tags");
?)