SPWebApplication.UpdateMappedPage-Methode

Die Zuordnung von benutzerdefinierten Anwendungen Seite aktualisiert.

Namespace:  Microsoft.SharePoint.Administration
Assembly:  Microsoft.SharePoint (in Microsoft.SharePoint.dll)

Syntax

'Declaration
Public Function UpdateMappedPage ( _
    key As SPWebApplication.SPCustomPage, _
    newValue As String _
) As Boolean
'Usage
Dim instance As SPWebApplication
Dim key As SPWebApplication.SPCustomPage
Dim newValue As String
Dim returnValue As Boolean

returnValue = instance.UpdateMappedPage(key, _
    newValue)
public bool UpdateMappedPage(
    SPWebApplication.SPCustomPage key,
    string newValue
)

Parameter

  • newValue
    Typ: System.String

    Der Speicherort der benutzerdefinierten Anwendungsseite. Dies muss mit "/ _layouts /" beginnen. Wenn die Zuordnung auf die benutzerdefinierte Seite entfernen möchten, legen Sie den Wert auf ein Nullverweis (Nothing in Visual Basic).

Rückgabewert

Typ: System.Boolean
true , wenn die benutzerdefinierte Anwendungsseite erfolgreich zugeordnet ist; andernfalls false.

Hinweise

Der Parameter newValue ist an einem Speicherort im Ordner/_layouts beschränkt. Beim Aktualisieren der zugeordneten Seite muss die URL mit "/ _layouts /" beginnen.

Beispiele

Das folgende Codebeispiel veranschaulicht, wie die Zuordnung zwischen der Standardseite AccessDenied.aspx Anwendung und eine benutzerdefinierte Anwendungsseite aktualisieren und in der Konsole anzuzeigen. Die ursprünglichen Anwendungsseite wird am Ende wiederhergestellt.

using System;
using System.Collections.Generic;
using System.Text;
using Microsoft.SharePoint;
using Microsoft.SharePoint.Administration;

namespace MapCustomAppPage
{
    class Program
    {
        static void Main(string[] args)
        {
            using (SPSite site = new SPSite("http://MyServer"))
            {
                //Get a reference to the web application.
                SPWebApplication webApp = site.WebApplication;

                //Update AccessDenied application page to AxsDnd.aspx.
                webApp.UpdateMappedPage(SPWebApplication.SPCustomPage.AccessDenied, "/_layouts/SubFolder/AxsDnd.aspx");
                webApp.Update();

                //Output the newly assigned application page.
                Console.Out.WriteLine(webApp.GetMappedPage(SPWebApplication.SPCustomPage.AccessDenied));

                //Reset the mapping to the default application page.
                webApp.UpdateMappedPage(SPWebApplication.SPCustomPage.AccessDenied, null);
                webApp.Update();

                Console.Out.WriteLine("Press any key...");
                Console.ReadKey();
            }
        }
    }
}
Imports System
Imports Microsoft.SharePoint
Imports Microsoft.SharePoint.Administration
Module Module1

    Sub Main()

        Using site As New SPSite("http://MyServer")
            'Get a reference to the web application.
            Dim webApp As SPWebApplication = site.WebApplication

            'Update AccessDenied application page to AxsDnd.aspx.
            webApp.UpdateMappedPage(SPWebApplication.SPCustomPage.AccessDenied, "/_layouts/SubFolder/AxsDnd.aspx")
            webApp.Update()

            'Output the newly assigned application page.
            Console.Out.WriteLine(webApp.GetMappedPage(SPWebApplication.SPCustomPage.AccessDenied))

            'Reset the mapping to the default application page.
            webApp.UpdateMappedPage(SPWebApplication.SPCustomPage.AccessDenied, Null)
            webApp.Update()

            Console.Out.WriteLine("Press any key...")
            Console.ReadKey()
        End Using

    End Sub

End Module

Siehe auch

Referenz

SPWebApplication Klasse

SPWebApplication-Member

Microsoft.SharePoint.Administration-Namespace