Nothing jumps out at me immediately -- what does the error code look like at various stages? That can tell you quite a bit sometimes.
When I first try to Get the dictionary I get an error 1146045247 and &ictionary is NULL.
I still try to SetStringEntry, and the error there is 1346458189
Is there other stuff I need to do , like getting a context ?
Dos every document/file have a dictionary by default?
If the first error is 1146045247 ("DOC?") and you get a NULL dictionary, anything further is not going to work.
Depending on where you are executing this code (for example, in response to a panel item click), yes, you may well need to get the AppContext first.
I was missing the App Context.