ArcGIS Pro 2.7 API Reference Guide
SaveMetadataAsXML Method (IMetadata)
Example 

ArcGIS.Desktop.Core Namespace > IMetadata Interface : SaveMetadataAsXML Method
Save the metadata of the current item as XML
Syntax
void SaveMetadataAsXML( 
   string outputFilePath,
   MDSaveAsXMLOption outputType
)
Sub SaveMetadataAsXML( _
   ByVal outputFilePath As String, _
   ByVal outputType As MDSaveAsXMLOption _
) 

Parameters

outputFilePath
outputType

Return Value

void
Example
await QueuedTask.Run(() => metadataItemToSaveAsXML.SaveMetadataAsXML(@"E:\Temp\OutputXML.xml", MDSaveAsXMLOption.esriExactCopy));
Requirements

Target Platforms: Windows 10, Windows 8.1

See Also

Reference

IMetadata Interface
IMetadata Members