Using Office Interop AdvanceSearch API method to query a Outlook folder isn't returning all the results, it's only returning results from 2 days ago! This code been running fine for over 2 years why is it failing now, and only failing on one machine? Turnsout the it's a new machine after the last one died a couple of days ago, and this lead me to the answer - Indexes... The indexes hadn't finished re-building from the last retore point, and if you use API before the Indexes are built you might not get all the results. If you dig into the Indexing Options it even tells you this, shame the API can't surface this warning.
After much banging my head against the internet here is a canonical example of how to configure SQL Server permissions, roles to get SqlDependency working in a .Net app. This is for sceneario where the identity running the .Net code is running as a configured user account with the db_datareader & db_datawriter. -- Create Schema User CREATE USER sql_dependency_schema_owner WITHOUT LOGIN; GO -- Create Schema for SqlDependency objects CREATE SCHEMA sql_dependency AUTHORIZATION sql_dependency_schema_owner; GO -- Create Role for users of [sql_dependency] CREATE ROLE sql_dependency_user; GO -- Grant role permissions GRANT CONTROL ON SCHEMA::sql_dependency TO sql_dependency_user; GRANT IMPERSONATE ON USER::sql_dependency_schema_owner TO sql_dependency_user; GRANT CREATE PROCEDURE TO sql_dependency_user; GRANT CREATE QUEUE TO sql_dependency_user; GRANT CREATE SERVICE TO sql_dependency_user; GRANT REFERENCES ON CONTRACT::[http://schemas.microsoft.com/SQL/Notifications/PostQueryNotificatio