Inside our remote event receivers we query the list item fields, using these 2 methods:-

  1. using the ItemEventProperties.AfterProperties

  2. Or querying the list using CAML query.

now in the first approach the data returned will always be of type string (not strongly typed). for example we have a People or Group field named ScoreUsers which allow multiple selections, and inside the ItemEventProperties.AfterProperties the users will be returned as a string, as follow:-

enter image description here

while if we query the list item using CAML or using GetItemByID, then the ScoreUsers will be of type FieldUserValue[] , as follow:-

enter image description here

so can we force the ItemEventProperties.AfterProperties to return strongly typed data?


1 Answer 1


It´s a complex question, but I'm try to make explanation based on Microsoft Docs and C# specifications:

Following the Microsoft Docs reference, the ItemEventProperties.AfterProperties is a Dictionary<string, Object>; then, to capture the Data, the developer needs to access the data from string key and returns the System.Object.

C# spec contains a concept that all types, value types (primitives) and reference types inherited from System.Object.

But, the response of your question depends from the nature of data and what programming resource that you need to adopt to resolve this problem.

For example, if we adopt the Facade Design Pattern, we can convert the data from Back-End (SharePoint in this case) and transform this to a POCO (Plain Old CLR Objects) class (or mentioned by others Developer like Entity class or Model class):

//Reference type to User Data
public class ScoreUser
    public string Login { get; set; }
    public string Email { get; set; }

//Reference type that represents SharePoint Item
//from ItemEventProperties.AfterProperties
public class SPRemoteEventReceiverFacade
    public SPRemoteEventReceiverFacade(Dictionary<string, object> afterPropertiesData)
        //TO DO: conversion routine...
        this.ID = int.Parse(afterPropertiesData["ID"].ToString());
        this.Title = afterPropertiesData["Title"].ToString();
        this.Breaks = Convert.ToDateTime(afterPropertiesData["Breaks"].ToString());
        this.ScoreUsers = new List<ScoreUser>();
        string[] spScoreUsers = afterPropertiesData["ScoreUsers"].ToString().Split(';');
        foreach(string user in spScoreUsers)
           this.ScoreUsers.Add(new ScoreUser()
             Login = user.Substring(0, user.IndexOf('@')).Replace("#",""),
             Email = user.Replace("#","")
    public int ID { get; set; }
    public string Title { get; set; }
    public DateTime Breaks { get; set; }
    public List<ScoreUser> ScoreUsers { get; set; }
//Inner the Remote Event Receiver Event:
SPRemoteEventReceiverFacade facade =
new SPRemoteEventReceiverFacade(properties.ItemEventProperties.AfterProperties);

So, at this moment, this would be the most feasible resource to achieve your requirement. I hope I've helped.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.