Skip to main content
added 34 characters in body
Source Link

SharePoint 2013 on-premise

What is the difference of using:

SPSecurity.RunWithElevatedPrivileges(() =>
{
    using (SPWeb web = site.OpenWeb())
    {
        ....
    }
}

with

SPSecurity.RunWithElevatedPrivileges(delegate()
{
    using (SPWeb web = site.OpenWeb())
    {
        ....
    }
}

the first code not work, but the second code if it works.

what is the difference between the second code works and the another not?

What is the difference of using:

SPSecurity.RunWithElevatedPrivileges(() =>
{
    using (SPWeb web = site.OpenWeb())
    {
        ....
    }
}

with

SPSecurity.RunWithElevatedPrivileges(delegate()
{
    using (SPWeb web = site.OpenWeb())
    {
        ....
    }
}

the first code not work, but the second code if it works.

what is the difference between the second code works and the another not?

SharePoint 2013 on-premise

What is the difference of using:

SPSecurity.RunWithElevatedPrivileges(() =>
{
    using (SPWeb web = site.OpenWeb())
    {
        ....
    }
}

with

SPSecurity.RunWithElevatedPrivileges(delegate()
{
    using (SPWeb web = site.OpenWeb())
    {
        ....
    }
}

the first code not work, but the second code if it works.

what is the difference between the second code works and the another not?

Source Link

using SPSecurity.RunWithElevatedPrivileges

What is the difference of using:

SPSecurity.RunWithElevatedPrivileges(() =>
{
    using (SPWeb web = site.OpenWeb())
    {
        ....
    }
}

with

SPSecurity.RunWithElevatedPrivileges(delegate()
{
    using (SPWeb web = site.OpenWeb())
    {
        ....
    }
}

the first code not work, but the second code if it works.

what is the difference between the second code works and the another not?