SPBackupRestoreLogSeverity enumeration
指定之問題的備份或還原作業期間發生,且記錄訊息的嚴重性。
Namespace: Microsoft.SharePoint.Administration.Backup
Assembly: Microsoft.SharePoint (in Microsoft.SharePoint.dll)
Syntax
'宣告
Public Enumeration SPBackupRestoreLogSeverity
'用途
Dim instance As SPBackupRestoreLogSeverity
public enum SPBackupRestoreLogSeverity
Members
Member name | Description | |
---|---|---|
Important | 很重要,但不是問題資訊的記錄項目。 | |
None | 沒有記錄項目。 | |
Error | 嚴重錯誤,可防止從完成作業。 | |
Warning | 問題需要進行的警告,但不是嚴重。 | |
Verbose | 較不重要的資訊的記錄項目不是發生問題。 | |
WorkItem | 日誌項目,識別特定後續備份或後還原需要完成的工時。 |
備註
這些值是主要做為Log方法的參數。
Examples
下列範例會示範如何使用中實作的OnRestore方法的列舉。
[C#]
public Boolean OnRestore(Object sender, SPRestoreInformation args)
{
if (args == null)
{
throw new ArgumentNullException("args");
}
// If the CriticalFiles object was deleted from the farm after it was
// backed up, restore it to the configuration database.
CriticalFiles cf = SPFarm.Local.GetChild<CriticalFiles>(this.Name);
if (cf == null)
{
this.Update();
args.Log(SPBackupRestoreLogSeverity.Verbose, this.Name + " added back to configuration database.");
}
Boolean successSignal = true;
// TODO: The following loop restores files to the local server. If there are
// multiple front end servers, your code must iterate through all of
// SPFarm.Local.Servers and restore the same files to every server whose
// Role property is SPServerRole.WebFrontEnd
foreach (String path in FrontEndFilePaths)
{
FileInfo backupCopy = new FileInfo(path);
FileInfo file = new FileInfo(args.Location + @"\" + backupCopy.Name);
try
{
file.CopyTo(path, true);
args.Log(SPBackupRestoreLogSeverity.Verbose, "Restored " + file.Name);
}
catch (Exception e)
{
args.Log(SPBackupRestoreLogSeverity.Verbose, file.Name + " not restored: " + e.Message);
successSignal = false;
}
}
args.CurrentProgress = 50;
return successSignal;
}