SPBackupRestoreSettings.IndividualItem property
取得或設定備份或還原的內容元件。
Namespace: Microsoft.SharePoint.Administration.Backup
Assembly: Microsoft.SharePoint (in Microsoft.SharePoint.dll)
Syntax
'宣告
Public Property IndividualItem As String
Get
Set
'用途
Dim instance As SPBackupRestoreSettings
Dim value As String
value = instance.IndividualItem
instance.IndividualItem = value
public string IndividualItem { get; set; }
Property value
Type: System.String
String 代表伺服器陣列或內容的元件備份或還原伺服器陣列的名稱。
備註
例如,Web 應用程式可能是名為"SharePoint – 80;"將內容資料庫可能是名為"WSS_Content_1234567890a2b4c6d8e0f2a4b6c8d0e2"。整個伺服器陣列是SharePoint Foundation中名為 [伺服器陣列]。
此屬性用來識別,請在spbackup.log或sprestore.log檔案中,在樹狀目錄中,會備份或還原之元件的上方的元件。它會呼叫的程式碼,以確保記錄檔做為第二個**FindItems()**方法的參數傳遞IndividualItem是正確的責任。(請參閱下面的程式碼範例)。
提供的一個可能相符項目,可運作的部分名稱。例如,"WSS_Content"就是足夠識別內容資料庫,但前提是僅有一個其名稱開頭為"WSS_Content"。如果兩個父項元件每個已具有相同名稱的子系,而且您想要備份 (或還原) 的其中一個,您可以釐清由附加至子名稱中之間 ; 反斜線字元前面的父系名稱例如,"SharePoint – 80\WSS_Content"。如果不明確的名稱已經傳送給**FindItems()**方法,它會傳回含有多個成員的集合。在此情況下呼叫程式碼應該要更具體的使用者提示。(請參閱以下的範例程式碼)。
您可以將此屬性設定為任何下列類型的元件:
整個伺服器陣列。(但不在伺服器陣列設定資料庫和管理中心應用程式的內容資料庫還原作業**[IndividualItem]**整個伺服器陣列時,將會還原)。
發佈 web 服務的任何內容,除了 WSS_Administration web 服務所發佈SharePoint Foundation管理中心應用程式的頁面。
內容發佈 web 服務,除了管理中心 Web 應用程式內任何 Web 應用程式。
Web 應用程式內的任何內容資料庫。但管理中心 Web 應用程式的內容資料庫只能IndividualItem備份作業。您無法還原管理中心應用程式的內容。其備份可能會很有用,讓它可以相較,疑難排解步驟,以與更新的版本,使用 SQL Server 工具建立資料庫的時間點記錄。
任何共用服務提供者所隨附增強的功能產品,例如Microsoft Office SharePoint Server 2007,安裝SharePoint Foundation上方。
實作IBackupRestore任何自訂內容元件。
![]() |
---|
在伺服器陣列設定資料庫隨附於備份作業如果IndividualItem整個伺服器陣列,但它不能IndividualItem本身。即使更重要的是,未還原伺服器陣列時IndividualItem的還原作業。您無法還原設定資料庫。其備份可能會很有用,讓它可以相較,疑難排解步驟,以與更新的版本,使用 SQL Server 工具建立資料庫的時間點記錄。 |
若要查看 itemization 元件的名稱可以是備份作業的物件在伺服器陣列上,您可以在伺服器命令列執行命令stsadm -o backup -showtree ,或瀏覽至 [作業 > 執行備份管理中心應用程式中。
若要取得,以程式設計方式可以是物件的備份作業,在伺服器陣列上的元件名稱是使用FindItems。
Examples
下列範例會示範如何在備份的應用程式中使用IndividualItem屬性。完整範例和它的詳細的資訊,請參閱 < How to: Programmatically Back Up Content。
static void Main(string[] args)
{
// Identify the location for the backup storage.
Console.Write("Enter full UNC path to the directory where the backup will be stored:");
String backupLocation = Console.ReadLine();
// Create the backup settings.
SPBackupSettings settings = SPBackupRestoreSettings.GetBackupSettings(backupLocation, "Full");
// Identify the content component to backup.
Console.Write("Enter name of component to backup (default is whole farm):");
settings.IndividualItem = Console.ReadLine();
// Set optional operation parameters.
settings.IsVerbose = true;
settings.UpdateProgress = 10;
settings.BackupThreads = 10;
// Create the backup operation and return its ID.
Guid backup = SPBackupRestoreConsole.CreateBackupRestore(settings);
// Ensure that user has identified a valid and unique component.
SPBackupRestoreObject node = EnsureUniqueValidComponentName(settings, ref backup);
// Ensure that there is enough space.
Boolean targetHasEnoughSpace = false;
if (node != null)
{
targetHasEnoughSpace = EnsureEnoughDiskSpace(backupLocation, backup, node);
}
// If there is enough space, attempt to run the backup.
if (targetHasEnoughSpace)
{
// Set the backup as the active job and run it.
if (SPBackupRestoreConsole.SetActive(backup) == true)
{
if (SPBackupRestoreConsole.Run(backup, node) == false)
{
// Report "error" through your UI.
String error = SPBackupRestoreConsole.Get(backup).FailureMessage;
Console.WriteLine(error);
}
}
else
{
// Report through your UI that another backup
// or restore operation is underway.
Console.WriteLine("Another backup or restore operation is already underway. Try again when it ends.");
}
// Clean up the operation.
SPBackupRestoreConsole.Remove(backup);
Console.WriteLine("Backup attempt complete. Press Enter to continue.");
Console.ReadLine();
}
}// end Main
Shared Sub Main(ByVal args() As String)
' Identify the location for the backup storage.
Console.Write("Enter full UNC path to the directory where the backup will be stored:")
Dim backupLocation As String = Console.ReadLine()
' Create the backup settings.
Dim settings As SPBackupSettings = SPBackupRestoreSettings.GetBackupSettings(backupLocation, "Full")
' Identify the content component to backup.
Console.Write("Enter name of component to backup (default is whole farm):")
settings.IndividualItem = Console.ReadLine()
' Set optional operation parameters.
settings.IsVerbose = True
settings.UpdateProgress = 10
settings.BackupThreads = 10
' Create the backup operation and return its ID.
Dim backup As Guid = SPBackupRestoreConsole.CreateBackupRestore(settings)
' Ensure that user has identified a valid and unique component.
Dim node As SPBackupRestoreObject = EnsureUniqueValidComponentName(settings, backup)
' Ensure that there is enough space.
Dim targetHasEnoughSpace As Boolean = False
If node IsNot Nothing Then
targetHasEnoughSpace = EnsureEnoughDiskSpace(backupLocation, backup, node)
End If
' If there is enough space, attempt to run the backup.
If targetHasEnoughSpace Then
' Set the backup as the active job and run it.
If SPBackupRestoreConsole.SetActive(backup) = True Then
If SPBackupRestoreConsole.Run(backup, node) = False Then
' Report "error" through your UI.
Dim [error] As String = SPBackupRestoreConsole.Get(backup).FailureMessage
Console.WriteLine([error])
End If
Else
' Report through your UI that another backup
' or restore operation is underway.
Console.WriteLine("Another backup or restore operation is already underway. Try again when it ends.")
End If
' Clean up the operation.
SPBackupRestoreConsole.Remove(backup)
Console.WriteLine("Backup attempt complete. Press Enter to continue.")
Console.ReadLine()
End If
End Sub ' end Main