If I create a global variable in one function, how can I use that global variable in another function?
Do I need to store the global variable in a local variable of the function which needs its access?
You don't have to use it in all cases (as someone here incorrectly claims) - if the name referenced in an expression cannot be found in local scope or scopes in the functions in which this function is defined, it is looked up among global variables.
However, if you assign to a new variable not declared as global in the function, it is implicitly declared as local, and it can overshadow any existing global variable with the same name.
In Outlook 2010 and previous, it is recommended to leave the option “Full Details” enabled.
In Outlook 2013 and Outlook 2016, you’ll find that this option is no longer available as full details are also used to build the Contact Card.
The only thing that work was to delete OAB file C:\Users\%username%\App Data\Local\Microsoft\Outlook\ BUT I have to do that every time when I create a new user or the user profile like phone numbers.
How can I create or use a global variable in a function?
In that case, you can completely reset it by deleting the files making up the OAB or by recreating your mail profile.
In general, Outlook will automatically update the Offline Address Book (OAB) for Exchange accounts once every 24 hours.
When it didn’t or when you want to make sure you do have the latest OAB available, you could manually trigger an update from within Outlook as well.
globvar = 0 def set_globvar_to_one(): global globvar # Needed to modify global copy of globvar globvar = 1 def print_globvar(): print(globvar) # No need for global declaration to read value of globvar set_globvar_to_one() print_globvar() # Prints 1 ' statement, you tell Python that it should look elsewhere for the name instead of assigning to it locally.
(I believe that this behavior originated largely through an optimization of local namespaces -- without this behavior, Python's VM would need to perform at least three name lookups each time a new name is assigned to inside a function (to ensure that the name didn't already exist at module/builtin level), which would significantly slow down a very common operation.) Each module has its own private symbol table, which is used as the global symbol table by all functions defined in the module.
Another way to make sure that you get a fresh copy of the OAB is by renaming the oab-files to when Outlook is closed.