IVsPersistHierarchyItem2.SaveItem Method (VSSAVEFLAGS, String, UInt32, IntPtr, Int32%)
Saves the hierarchy item to disk.
Namespace: Microsoft.VisualStudio.Shell.Interop
Assembly: Microsoft.VisualStudio.Shell.Interop (in Microsoft.VisualStudio.Shell.Interop.dll)
Syntax
'Declaration
Function SaveItem ( _
dwSave As VSSAVEFLAGS, _
pszSilentSaveAsName As String, _
itemid As UInteger, _
punkDocData As IntPtr, _
<OutAttribute> ByRef pfCanceled As Integer _
) As Integer
'Usage
Dim instance As IVsPersistHierarchyItem2
Dim dwSave As VSSAVEFLAGS
Dim pszSilentSaveAsName As String
Dim itemid As UInteger
Dim punkDocData As IntPtr
Dim pfCanceled As Integer
Dim returnValue As Integer
returnValue = instance.SaveItem(dwSave, _
pszSilentSaveAsName, itemid, punkDocData, _
pfCanceled)
int SaveItem(
VSSAVEFLAGS dwSave,
string pszSilentSaveAsName,
uint itemid,
IntPtr punkDocData,
out int pfCanceled
)
int SaveItem(
[InAttribute] VSSAVEFLAGS dwSave,
[InAttribute] String^ pszSilentSaveAsName,
[InAttribute] unsigned int itemid,
[InAttribute] IntPtr punkDocData,
[OutAttribute] int% pfCanceled
)
abstract SaveItem :
dwSave:VSSAVEFLAGS *
pszSilentSaveAsName:string *
itemid:uint32 *
punkDocData:IntPtr *
pfCanceled:int byref -> int
function SaveItem(
dwSave : VSSAVEFLAGS,
pszSilentSaveAsName : String,
itemid : uint,
punkDocData : IntPtr,
pfCanceled : int
) : int
Parameters
- dwSave
Type: Microsoft.VisualStudio.Shell.Interop.VSSAVEFLAGS
[in] Flags whose values are taken from the VSSAVEFLAGS enumeration.
- pszSilentSaveAsName
Type: System.String
[in] File name to be applied when dwSave is set to VSSAVE_SilentSave.
- itemid
Type: System.UInt32
[in] Item identifier of the hierarchy item saved from VSITEMID.
- punkDocData
Type: System.IntPtr
[in] Pointer to the IUnknown interface of the hierarchy item saved.
- pfCanceled
Type: System.Int32%
[out] true if the save action was canceled.
Return Value
Type: System.Int32
If the method succeeds, it returns S_OK. If it fails, it returns an error code.
Implements
IVsPersistHierarchyItem.SaveItem(VSSAVEFLAGS, String, UInt32, IntPtr, Int32%)
Remarks
COM Signature
From vsshell.idl:
HRESULT IVsPersistHierarchyItem2::SaveItem(
[in] VSSAVEFLAGS dwSave,
[in] LPCOLESTR pszSilentSaveAsName,
[in] VSITEMID itemid,
[in] IUnknown *punkDocData,
[out] BOOL *pfCanceled
);
The caller of this method is responsible for determining whether the document is in the Running Document Table and should pass in the correct punkDocData parameter. It is not necessary for the implementer of this method to call the FindAndLockDocument method when punkDocData is nulla null reference (Nothing in Visual Basic).
When a document is saved, this method is called to enable the owning hierarchy to establish control. Then the hierarchy can use any private mechanism to persist the document. For hierarchies that use standard editors, the implementation of SaveItem method is to call the following:
For VSSAVE_Save and VSSAVE_SaveAs, it will QueryInterface for IVsPersistDocData on the document data object and call SaveDocData.
For VSSAVE_SilentSave, it will QueryInterface for IPersistFileFormat on the document data object and use this interface in a call to the method SaveDocDataToFile passing the parameters VSSAVE_SilentSave, pPersistFile, pszSilentSaveAsNamelpstrUntitledPath, &bstrDocumentNew*,* and&fCanceled).
.NET Framework Security
- Full trust for the immediate caller. This member cannot be used by partially trusted code. For more information, see Using Libraries from Partially Trusted Code.
See Also
Reference
IVsPersistHierarchyItem2 Interface