HRESULT SetSharedFolderState([in] BSTR shareName, [in] BSTR hostPathName, [in] LONG flags, [in] ICallback* jobDoneCallback, [out,retval] IJob** setJob);
This function modifies the state of a shared folder mounted in the virtual machine.
Dim job Dim err Dim numSharedFolders Dim results Dim folderName Dim folderHostPath results = Nothing Set job = vm.GetNumSharedFolders(Nothing) err = job.Wait(Array(VixCOM.Constants.VIX_PROPERTY_JOB_RESULT_SHARED_FOLDER_COUNT), results) If lib.ErrorIndicatesFailure(err) Then ' Handle the error... End If numSharedFolders = results(0) Dim propIds Redim propIds(2) ' Build an array of properties to request propIds(0) = VixCOM.Constants.VIX_PROPERTY_JOB_RESULT_ITEM_NAME propIds(1) = VixCOM.Constants.VIX_PROPERTY_JOB_RESULT_SHARED_FOLDER_HOST propIds(2) = VixCOM.Constants.VIX_PROPERTY_JOB_RESULT_SHARED_FOLDER_FLAGS For i=0 to numSharedFolders-1 Set job = vm.GetSharedFolderState(i, Nothing) ' Wait for the result, and get the result properties err = job.Wait(propIds, results) If lib.ErrorIndicatesFailure(err) Then ' Handle the error... End If folderName = results(0) ' VIX_PROPERTY_JOB_RESULT_ITEM_NAME folderHostPath = results(1) ' VIX_PROPERTY_JOB_RESULT_SHARED_FOLDER_HOST folderFlags = results(2) ' VIX_PROPERTY_JOB_RESULT_SHARED_FOLDER_FLAGS ' Make all folders writable. Set job = vm.SetSharedFolderState(folderName, folderHostPath, VixCOM.Constants.VIX_SHAREDFOLDER_WRITE_ACCESS) err = job.WaitWithoutResults() If lib.ErrorIndicatesFailure(err) Then ' Handle the error... End If Next