Sharepoint Online remote event receiver without App/Add-in - event-handling

The company I work for uses SharePoint Online. We have a requirement that on most site collections, whenever a user creates a new document library that the document library is configured with the "document" content type being removed, and replaced with some of our own corporate content types.
Previously I've managed this by using a coded sandbox solution installed on relevant site collections which had an event handler that fired on "list added". It's obviously now time to move away from that solution.
I'm really struggling to get to grips with the alternative, conceptually. I'm aiming to replace the old solution with a Remote Event Receiver solution.
The way I think I'd like to achieve this:
1) Create a single remote event receiver hosted in Azure which receives details of a new list being added in a site which it then configures appropriately.
2) Use CSOM to provision the site and as part of that provisioning, hook up the event receiver.
I've spent a lot of time on this, getting nowhere. I initially thought the answer lied in using an App which I could install in the App Catalog and then push out to particular site collections but that doesn't seem to be right.
Is the solution above possible? All examples on the web I've come across of setting up remote event receivers seem to use a SharePoint app which I don't really want to do.
Thanks.

For info I found the answer. You can indeed create a remote event receiver without a SharePoint app/add-in.
The answer was written up here
I thought I needed a SharePoint Provider Hosted App for that part 1
But you should bear in mind that as per Remove event receivers on host web clientContext you will not have the client Context passed through, so
TokenHelper.CreateRemoteEventReceiverClientContext(properties)
...will come through as empty. If you want to interact with SharePoint then you'll need to find another way than this approach, or use a different set of credentials.

Related

API to access Google Doc "Email Notification settings"

We have hundreds of business documents, and when a user makes a suggested edit or comment it's the manager's responsibility to review and approve/reject.
Google offers a feature to receive an email notification when a comment is made or suggested edit made(otherwise easy for managers to loose track or not know about suggested edits/comments), and we'd like to turn this on for managers but manually doing this for hundreds of documents is a maintenance nightmare. Is there an API that would allow us programmatically set this field, or even read it.
If there are no APIs is there some other recommended work flow such that employees can suggest improvements and managers will be proactively notified so they can approve/reject the suggestion(ISO 9001 Control of Documents/Records)?
PS I wrote some scripts to poll documents for open comments/suggestion, but we'd prefer to be proactively notified.
You could create a program to watch changes in files by using the SuggestionsViewMode. You need to fetch the entire document content and then look through it for suggestions.
result = service.documents().get(documentId=DOCUMENT_ID, suggestion_mode=SUGGEST_MODE).execute()
I assume by the previous response that there is not a way to change notification settings for a doc via API?
I actually have sort of the opposite problem of the OP, where I am generating lots of documents for a shared drive via automations. These docs are used by our team, but aren't generally relevant to me. Because my account is the one generating the docs, the notification setting defaults to "All comments and tasks".
It would be great if I could update my automation to change the notification setting to "Comments and tasks for you" after creating the doc. I'd appreciate any suggestions.

How can I get a list of my Installations in Azure Notification Hub

I'm trying to figure out how to use the recommended approach from Microsoft and use the Installation Model to handle registrations.
I want to be able to get some information about the installations that should have been saved and I see that there are two methods that could be useful
GetInstallation(string installationId) and GetInstallationAsync(string installationId)
Problem is that when making at call to any of them I never get a response back. I can't figure out what I might be doing wrong.
Here's the answer from a similar question (that still holds true as of Nov 2016):
... there's no way to get all installations for a hub. In the future, the
product team is planning to add this feature to the installations
model, but it will work in a different way. Instead of making it a
runtime operation, you'll provide your storage [account] connection string and
you'll get a blob with everything associated with the hub.

How can i update tags for a Azure NotificationHub installation via the backend, without an installationId?

I'm using the Installation approach to handle my push notifications.
Works great!
However, how can i update tags for an installation via the backend, without knowing the installationId?
E.g with Registrations, i can do this:
_hub.GetRegistrationsByTagAsync("member:1")
To then update all registrations for that user, via my backend.
But how do i do this with installations? There is no equivalent GetInstallationsByTagAsync, there is only GetInstallationAsync, which needs the installationId (which i don't have, since this a backend/background operation).
Notification Hubs does not have a getInstallationByTag method available at this point in time so Installation IDs would be necessary. It is on our roadmap to provide a complete set of registration equivalent support for installations.

Azure subscription disabled in portal but active on the account.windowsazure.com

I wanted to transfer resources (web apps) from an old subscription that had been disabled onto my new active subscription. I created a support request and they changed the disabled subscription into a Pay-As-You-Go -type and now using PowerShell I should be able to transfer my work over.
However I am still unable to access the old resource group in PS, for example when using Get-AzureRMResourceGroup only the new group I created comes up. I am also unable to do absolutely anything with my old work, even though the sub should now be active. I believe this is the reason I am unable to make the transfer. The title poses the actual dilemma that I believe is the root of my problems so, does anyone know a way to change this? Also I am happy to be corrected if I'm way off, or just be suggested an alternative approach.
Here's a silly picture to show the inconsistency I'm speaking of.

Can Microsoft Windows Workflow route to specific workstations?

I want to write a workflow application that routes a link to a document. The routing is based upon machines not users because I don't know who will ever be at a given post. For example, I have a form. It is initially filled out in location A. I now want it to go to location B and have them fill out the rest. Finally, it goes to location C where a supervisor will approve it.
None of these locations has a known user. That is I don't know who it will be. I only know that whomever it is is authorized (they are assigned to the workstation and are approved to be there.)
Will Microsoft Windows Workflow do this or do I need to build my own workflow based on SQL Server, IP Addresses, and so forth?
Also, How would the user at a workstation be notified a document had been sent to their machine?
Thanks for any help.
I think if I was approaching this problem workflow would work to do it. It is a state machine you want that has three states:
A Start
B Completing
C Approving
However workflow needs to work in one central place (trust me on this, you only want to have one workflow run time running at once, otherwise the same bit of work can be done multiple times see our questions on MSDN forum). So a central server running the workflow is the answer.
How you present this to the users can be done in multiple ways. Dave suggested using an ASP.NET site to identify the machines that are doing the work, which is probably how I would do it. However you could also write a windows forms client that would do the same thing. This would require using something like SOAP / WCF to facilitate communication between client form applications and the central workflow service. This would have the advantage that you could use a system try icon to alert the user.
You might also want to look at human workflow engines, as they are designed to do things such as this (and more), I'm most familiar with PNMsoft's Sequence
You can design a generic "routing" workflow that will cause data to go to a workstation. The easiest way to do this would be to embed the workflow in an ASP.NET application. Each workstation should visit the application with a workstation ID in the querystring:
http://myapp/default.aspx?wid=01
When the form is filled out at workstation A, the workflow running in the web app can enter it into the "work bin" of the next workstation. Anyone sitting at the computer for which the form is destined will see it appear in their list of forms to review. You can use AJAX to make it slick and auto-updating.