sharepoint enterprise – ItemUpdated event not firing

I have this code where only ItemAdding is firing when I add new item in the list but ItemUpdated doesn’t fire. I am expeting that when new item is added then first ItemAdding fires (which is working) and then ItemUpdated is fired (which is not working).

ItemUpdated only fires after item has been created and then I manually edit record.

public override void ItemAdding(SPItemEventProperties properties)
{
   if (properties.ListTitle == "MyList")
   {
      base.ItemAdding(properties);
      properties.AfterProperties("Department") = "Information Technology";
   }
}

public override void ItemUpdated(SPItemEventProperties properties)
{
   //some code here
}

In elements.xml file I have written following for both events but no luck. Even if I remove this line then it still doesn’t work.

<Synchronization>Synchronous</Synchronization>

How to fix this issue?

security – How we can secure the ClientID & ClientSecret inside our remote event receivers (Inside SharePoint Provider hosted app)

I have developed many remote event receivers and host them inside azure web apps. now the web.config file inside those remote event receivers contain the ClientId & ClientSecret, as follow:-

 <appSettings file="custom.config">
    <add key="ClientId" value="e***7" />
    <add key="ClientSecret" value="h***g=" />
  </appSettings>

Now if a hacker or an end user found those values inside the project code, then the user can control all the sites, as when we register the remote event receivers we grant them full control on the site collection.. so any advice how we can secure those details? so if someone access the source code of the RER then she/he can not view those details?

Thanks

Azure Event Hub vs Event Grid or something else?

I have a timer function that calls a group of APIs asynchronously and then converts the XML responses to SQL Server records to an on premises database. I want to send a message in case there is a failure in the response so that I can retry the API call. After reading the documentation for Event Hubs and Event Grids, I’m not sure if either one of those options satisfies my requirement. The following is the documentation I’ve read:

https://docs.microsoft.com/en-us/azure/event-hubs/event-hubs-about

https://docs.microsoft.com/en-us/azure/event-grid/compare-messaging-services

Any insight would be appreciated.

magento2 – Can’t get getCustomer() in custom event

If I observe customer_save_after event I can get information about the customer with $customer = $observer->getEvent()->getCustomer();.

However, if dispatching my custom event instead of customer_save_after I get

Error: Call to a member function getDataModel() on null

when I try to get it like $customerData = $customer->getDataModel();

I think this is because I can’t even get getCustomer() in an custom event.

Is there anything I could do to get the same data as from customer_save_after?

development – I am no longer able to debug/run my SharePoint Remote Event Receiver locally using Ngrok

Last month the below steps were working well for me to debug and test a SharePoint online remote event receiver locally:-

  1. Open Ngrok.exe >> run the following command inside ngrok:-
 ngrok authtoken 3***e
 ngrok http --host-header=rewrite  57269
  1. register a new app:- @ https://.sharepoint.com/sites//_layouts/15/AppRegNew.aspx >> enter the above Ngrok urls inside the App Redirect URL & App Domain.

  2. Inside the _layouts/15/appinv.aspx >> I search for the above app using Client ID >> and enter the following:-

 <AppPermissionRequests AllowAppOnlyPolicy="true">
   <AppPermissionRequest Scope="http://sharepoint/content/tenant" Right="FullControl" />
 </AppPermissionRequests>
  1. Update the service’s web config with the above ClientID and ClientSecret

  2. Register the new remove event receiver as follow:-

 Add-PnPEventReceiver -List "Order Management" -Name "TasksRER" -Url http://cc6e945e82f6.ngrok.io/service1.svc -EventReceiverType ItemUpdated -Synchronization Asynchronous

But today when I tried the above steps it failed >> where inside my event receiver when I tried to get the SharePoint context >> I will get that the Context is null:-

  public void ProcessOneWayEvent(SPRemoteEventProperties properties)
         {
             var prop = properties;
             var listItemID = properties.ItemEventProperties.ListItemId;
             var listTitle = properties.ItemEventProperties.ListTitle;
             using (ClientContext context = Helpers.GetAppOnlyContext(properties.ItemEventProperties.WebUrl))
             {
                 context.Load(context.Web);
                 context.ExecuteQuery();

Here is a screen shot from Visual Studio with the error i am getting when trying to get the context:-

enter image description here

Any advice if anything has been changed which is preventing me from running the above steps? which were working well last month?
Thanks

here is the code for the GetAppOnlyContext

     public class Helpers
         {
             public static ClientContext GetAppOnlyContext(string siteUrl)
             {
                 try
                 {
                     Uri siteUri = new Uri(siteUrl);
                     string realm = TokenHelper.GetRealmFromTargetUrl(siteUri);
                     string accessToken = TokenHelper.GetAppOnlyAccessToken(TokenHelper.SharePointPrincipal, siteUri.Authority, realm).AccessToken;
        
                     return TokenHelper.GetClientContextWithAccessToken(siteUri.ToString(), accessToken);
                 }
        
                 catch (Exception ex)
                 {
                     Trace.TraceInformation("GetAppOnlyContext failed. {0}", ex.Message);
                 }
                 return null;
             }
        
             public static ClientContext GetAuthenticatedContext(string siteUrl)
             {
                 string userName = WebConfigurationManager.AppSettings.Get("AuthenticatedUserName");
                 string password = WebConfigurationManager.AppSettings.Get("AuthenticatedUserPassword");
                 return GetAuthenticatedContext(siteUrl, userName, password);
             }
        
             public static ClientContext GetAuthenticatedContext(string siteUrl, string userName, SecureString password)
             {
                 ClientContext ctx = new ClientContext(siteUrl);
                 ctx.Credentials = new SharePointOnlineCredentials(userName, password);
                 return ctx;
             }
        
             public static ClientContext GetAuthenticatedContext(string siteUrl, string userName, string password)
             {
                 SecureString securePassword = GetPassword(password);
                 return GetAuthenticatedContext(siteUrl, userName, securePassword);
             }
        
             private static SecureString GetPassword(string passwd)
             {
                 var secure = new SecureString();
                 foreach (char c in passwd)
                 {
                     secure.AppendChar(c);
                 }
                 return secure;
             }
        
             public static string EmptyIfNull(object obj)
             {
                 return obj == null ? "" : obj.ToString();
             }
         }
     }  

seem this statement string accessToken = TokenHelper.GetAppOnlyAccessToken(TokenHelper.SharePointPrincipal, siteUri.Authority, realm).AccessToken; inside my Helpers.GetAppOnlyContext will raise this error token request failed, as follow:-

enter image description here

Event recurs day before 2nd Sunday?

Our church has Communion on 2nd & 4th Sunday of every month. Using Google Calendar, we need an appointment for the Saturday before to prepare things.

Event and Emit in Solidity

Hope all doing well.
I want to do the following TWO activities in the SOLIDITY code written below:-
An ASAP help will be highly appreciable.
Thanks with regards
Syed

Activities:-

Emit an event ScoreChanged with two arguments: int amount (equal to the value that was sent) and bool direction (true for up function and false for down).

Emit an event GameEnded after gameOver is switched to true

Solidity code:-

pragma solidity ^0.4.17;

contract TugOfWar {

int public score = 0;
int constant endAt = 1 ether;
bool public gameOver = false;

function up() external payable {
    require(msg.value > 0);
    require(!gameOver);

    int value = int(msg.value);
    score += value;

//
checkIfGameOver();
}

function down() external payable {
    require(msg.value > 0);
    require(!gameOver);

    int value = int(msg.value);
    score -= value;

//

    checkIfGameOver();
}

function checkIfGameOver() internal {
    if(score >= endAt || score <= endAt * -1) {
        gameOver = true;

        //
    }
}

}

dnd 5e – Does this lake event in the “Icewind Dale: Rime of the Frostmaiden” adventure allow a grapple as an opportunity attack?

There is an event in Icewind Dale: Rime of the Frostmaiden (an official D&D 5e adventure by Wizards of the Coast) that seems to allow for a grapple attack as an opportunity attack. In the Lake Events table on p. 30, it lists the following result for a roll of 15 on the d20:

A knucklehead trout (…) leaps out of the lake, makes a tail attack against one random character in the boat, and dives back into the frigid water. A character with a passive Wisdom (Perception) score of 13 or higher is not surprised by the fish and can use its reaction to make an opportunity attack against it or try to grapple the fish as it dives back into the water.

To me, this implies that the reaction is used to make an opportunity attack, but that attack can be substituted with the grapple special attack – which goes against the rules as written, which state that a grapple can only be done with the Attack action, not as an opportunity attack.

Now, if the character is before the fish on initiative, it could use the Ready action to ready an attack, then use that attack to grapple. But the text doesn’t mention Ready, nor does it state that the fish has lost initiative to the grappling character, which would be required to Ready a grapple. If the fish is earlier on initiative, the character could react with an opportunity attack but could not have an action (to grapple) already Readied.

Does this imply that you can grapple with an opportunity attack, or is it just a case of specific beats general, applying only to this specific fish-slap encounter?

Or is it just alluding to the Ready action, in a roundabout way? (If it is the Ready action, it requires the character was not surprised, rolled higher initiative, and correctly deduced that the fish was going to use a split move to approach, attack, and then retreat.)

Note: This situation does not follow the rules provided earlier for fishing for knucklehead.

unity – Should the interaction between the player and world objects be handled from the player class or as an event from the object classes?

Suppose you’re making a 3D platformer like Super Mario, if you jump on a Goomba, does Mario (the class) know that it just landed on a Goomba and then tell that Goomba to die, or does the Goomba realize that he is being smashed and dies ?

I want to go with the first approach but it will end up with a huge If/then (or Switch/Case) script, also the reason why this is “problematic” is that many objects will make the player have a “reaction”, for example if you land on a Goomba, you don’t just kill it, but it forces you to jump, that jump event, what’s the best way to handle it ?

Thanks