Name

SetSharedFolderState

Description

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.

Parameters

shareName
Specifies the name of the shared folder.
hostPathName
Specifies the host path of the shared folder.
flags
The new flag settings.
jobDoneCallback
An ICallback instance that will be called when the operation is complete.
setJob
Returns an IJob object that describes the state of this asynchronous operation.

Return Value

HRESULT

Remarks

Side Effects

None.

Requirements

VixCOM.h, since VMware Workstation 6.0

Example

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

Set results = Nothing
Set job = Nothing
Set vm = Nothing

Copyright (C) 2007-2010 VMware, Inc. All rights reserved.