SPCFolder.MoveFolderEx
This function moves this folder to a new parent. newParent param can be an SPCFolder object or a folder id (with audit log explanation).
Syntax | Parameters | Return Value |
---|---|---|
Sub SPCFolder.MoveFolderEx( _ newParent As Variant, _ UpdateInfo As FolderUpdateInfo) |
The SPCFolder that this folder is being moved to. Type: Variant The explanation for this operation (used for SDMS logging). Type: FolderUpdateInfo |
This function does not return a value. |
Remarks
DetachEx/AttachEx do not work with subfolders (also SPCFolder objects) you must use MoveFolderEx/RemoveFolderEx for these.
SVB Example
Moving the contents of one folder to another:
Sub Main Dim oOM As ObjectManager 'Reconnect into Enterprise ObjectManager Set oOM = New ObjectManager oOM.Reconnect Application 'The folder whose content will be moved Dim MyFolder As SPCFolder Set MyFolder = oOM.FindFolder("/Blake's Materials") If (MyFolder Is Nothing) Then MsgBox "Can't find the personal folder" Exit All End If 'The folder to move the content to Dim CompanyFolder As SPCFolder Set CompanyFolder = oOM.FindFolder("/Company Materials") If (CompanyFolder Is Nothing) Then MsgBox "Can't find the company folder" Exit All End If 'Retrieve the folder's content Dim MyContent Set MyContent = MyFolder.List(swcBinaryDocument Or swcCharacteristic Or swcDashboard Or swcFolder Or swcLabel Or swcMonitor Or swcProfile Or swcStandardProfileSequence Or swcTaskset) 'Start moving the content Dim moveInfo As New FolderUpdateInfo moveInfo.AuditLogReason = "Moving my content to Company folder" Dim i As Long oOM.Transaction.Start On Error GoTo rollback For i = LBound(MyContent) To UBound(MyContent) If (TypeName(MyContent(i)) = "SPCFolder") Then 'NOTE: COMMENT OUT THE FOLLOWING LINE IF YOU DON'T WANT TO MOVE SUBFOLDERS 'Also, it should be noted that DetachEx/AttachEx do not work with SPCFolder objects, 'you must use MoveFolderEx for these. MyContent(i).MoveFolderEx(CompanyFolder,moveInfo) Else MyFolder.DetachEx(MyContent(i), moveInfo) CompanyFolder.AttachEx(MyContent(i), moveInfo) End If Next oOM.Transaction.Commit rollback: oOM.Transaction.Rollback oOM.Disconnect End Sub
Copyright © 2020. Cloud Software Group, Inc. All Rights Reserved.