How to create Remote Event receiver for GroupUserAdded event - sharepoint

I have a specific situation where, I need to perform some activity when a new user is added to a SharePoint Group. I am trying to achieve this by using Remote event receivers but i am unsuccessful so far. I couldn't find any reliable resources explaining how the GroupUserAdded event type can be attached to the Remote event receiver.
I know it is possible to attach these event types using the farm solution in SharePoint on premise. but i am specifically looking for Remote event receivers as we don't want to write a farm solution and also we want to extend this to SharePoint online.
Problem : Unable to attach Security related Event types such as GroupUserAdded to Remote event receivers
Sharepoint versions : Sharepoint 2013/2016 and Sharepoint Online.
Please note that, I am able to attach the basic event types such as ListItemAdded,ListItemUpdated etc. So i am not looking for a general steps about how to setup a Remote event receivers, but i am trying to solve a specific issue about why it is not possible to attach GroupUsersAdded event type to the Remote event receivers in Sharepoint Online or Sharepoint 2013/2016.

here's a C# code snippet from my solution which does work (SP Online):
var eventReceiverUserAdded =
new EventReceiverDefinitionCreationInformation
{
EventType = EventReceiverType.GroupUserAdded,
ReceiverName = "GroupMembershipChanged", // can be anything
ReceiverUrl = url, // supply your own
SequenceNumber = 1000
};
web.EventReceivers.Add(eventReceiverUserAdded);
web.Context.ExecuteQuery();
Just supply the url of your handler as url. I used an Azure Function for that.

Related

Kentico 10 - Custom action on page update

I am looking to perform a custom action when a content editor in Kentico 10 updates a page and it eventually gets published.
To be more specific we have a custom page type for products which also as an "Updated" checkbox allowing the editor to mark it as updated. When this happens (gets marked as updated) I would like to send an email out to users that have a registered interest in this product that it has been updated.
I was looking through the documentation and came across Global Events here: https://docs.kentico.com/k10/custom-development/handling-global-events/reference-global-system-events#Reference-Globalsystemevents-DocumentEvents
I was wondering if using global events to intercept the save action when the editor updates the product is the way to go here or if there is a better approach.
Kentico does n't have this functionality out of the box, but we can achieve this by writing Custom code for Global Event and a scheduler (if No.of mails is large)
Recommended steps:
Attach custom code to Global event handler while publish specific document publish after event
public override void Init()
{
// Assigns custom handlers to the appropriate events
WorkflowEvents.Publish.After += new EventHandler(DocumentPublishCustomEvent);
}
In the custom code, if required page is published then make entries into custom table for email to be sent [This step is optional you can send mail from custom event handler directly if only few mails to be sent]
3.Implement custom scheduler to pick the user info from custom table and send email to user.
Note: Ideally you can use email Template for send emails
Using Global events is one way of doing this, another way would be to use Kentico's Advanced workflow engine (If you have the EMS license):
https://docs.kentico.com/k10/managing-website-content/configuring-the-environment-for-content-editors/configuring-workflows/designing-advanced-workflows
You could create a custom workflow step and action which the editors would put the page into and which would send emails to interested people - https://docs.kentico.com/k10/managing-website-content/configuring-the-environment-for-content-editors/configuring-workflows/designing-advanced-workflows/creating-custom-action-workflow-steps
If you do not have the EMS License, using Global events seems like the way to go, but I don't see the updated flag field as necessary, you could easily check in the global event handler if the product arrived at the "Published" workflow step in the basic workflow and then send the email to the interested parties.

subscription service - email sending

Am looking for some help in a subscription service email sending from domino using Xpages.
scenario : Paul Goodman is a building contractor and he would like to subscribe to his category named "Buildings and Road”.
When someone asks question about his category "Buildings and Road” he and everyone else that have the same subscription , should get email. I have a LS Agent that goes thought a view to send these emails but I would like
to have his done as soon as the message is saved and it has to send one at the time to void spam filters. I know I could execute the LS agent onSave but do you see another solution maybe with JavaScript ? I have only seen some .NET & PHP solutions here.
You have a series of options here:
Extract your logic into a LS library, so it can be used by several agents. Then have on that runs on save (and another one on a new subscription)
Use a DOTs task to listen to documents save - you can write your logic in Java then
Call an ?OpenAgent URL from your client side JavaScript
Put it into your XPage for new articles
Since you have the agent already, I'd go with the first one

How to get data between connecting web part in Sharepoint 2013

are there any ways that in the eventreceiver of one of the two connected lists, i can get the filter value between 2 connected list web parts.
BR
Kelvin
Event receiver will not help you as it triggers item related events like create, update, delete. Event receiver cannot reach data sent from one webpart to another. You can create your own webpart that can receive data and connect it to task webpart same way as webpart with document library. I created webpart that can get data from another webpart via data connection. You can find it here including sources: https://spgooglemappart.codeplex.com

Can i get the event about file operation on OneDrive?

As we know, we can add remote event receiver to the list. then if there is a item added or updated in this list, we can get the event send by sharepoint 2013 online.
This is the info about event in sharepoint:
[https://msdn.microsoft.com/en-us/library/Microsoft.SharePoint.SPItemEventReceiver_methods.aspx]
So can we have this kind of method in OneDrive(skydrive) too?
It means when there is a file added in the OneDrive, then my App can get this event and take some action on this file.
thanks.
The OneDrive API does not (yet!) support subscriptions to events. Please visit the OneDrive user voice and make/vote up topics that you'd like to see implemented.
To question #2 the view.changes api allows for applications to easily know which changes have happened since the application last queried OneDrive might be just what you need without subscriptions.

Setting up a weekly digest in Sharepoint

I'm currently working on a MOSS 2007 site and i need to set up a "system" which will e-mail all the changes in all the lists and libraries in the site.
I'm new to the Sharepoint world, i wonder if it is possible.
P.S. I have no access to the Central Administration panel. (If it has anything to do with my purpose)
Thanks
You can write custom timer job to do this task.
You could do it in this way:
Create custom timer job feature, set timerjob schedule.
On FeatureActivated event add that timerjob to SharePoint and have a [Persisted] property like SiteUrl in timerjob, which you could pass in constructor to let timerjob determine with which site to work with.
Use SPWeb.SiteUsers to get all users in SharePoint.
Loop each user, open new SPSite impersonated as each user.
On SPSite.RootWeb (SPWeb) execute GetSiteData (read community comments for some great examples and explanation on how to use it). Use Query that queries items where Modified field has value greater than (follow link for important info to query correctly) what you want.
Generate html out of your data and SPUtility.SendMail.
There is a scheduled reminder job feature available. However it works only on 1 List scope. But you can download source code, open RmdJobDefinition class and just see how it works to assist you writing your own class.
Good luck.
I'm afraid you can only setup the alert on a list (or item) basis. In the list you go to Actions => Alerts => When to send alerts => Weekly. I didn't check the Central Admin since you don't have access in your scenario.

Resources