IVsPersistHierarchyItem::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)

int SaveItem(
	VSSAVEFLAGS dwSave,
	String^ pszSilentSaveAsName,
	unsigned int itemid,
	IntPtr punkDocData,
	[OutAttribute] int% pfCanceled
)

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.

From vsshell.idl:

HRESULT IVsPersistHierarchyItem::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 null.

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:

Return to top
Show: