I try to use following PowerShell script in iLoveSharePoint.PowerEventReceiver
function ItemAdding
{
$url = 'http://win-4cc5e89pifo:1234/docs/'
$web = Get-SPWeb -webUrl $url
$list = $web.Lists['CodeBehind']
foreach ($item in $list)
{
if ($item.Title -eq $properties.AfterProperties["Title"])
{
$properties.Status = [Microsoft.SharePoint.SPEventReceiverStatus]::CancelWithRedirectUrl
$properties.RedirectUrl = [Microsoft.SharePoint.Utilities.SPUrlUtility]::CombineUrl($properties.Web.Url,"/SitePages/step1.aspx?p=1")
break
}
}
}
Where is an error?
试试这个CombineUrl($web.Url,
或
$httpContext.Response.Redirect("somewhere/to/go",$true);
There seems to be no named parameter -webUrl
for the Get-SPWeb
Cmdlet.
Try
$web = Get-SPWeb $url
in your script instead.
Also check if $web
isn't null.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.