CLI 参考 > 工作流和文档命令 > im importcontent
  
im importcontent
creates content from imported information
Synopsis
im importcontent[--parentID=value] [--insertLocation[=number|first|last|before:name|after:name] [--segmentType=type] [--field=value] [--customFieldDefinition=value] [--customFieldValue=value] [--richContentField=value] [--subInsertMode=[reference|include]] [--addRelationships=value] [--addSourceTrace=value] [--addSourceLink=value] [--addAttachment=value] [--type=type] [--quiet] [--user=name] [--hostname=server] [--password=password] [--port=number] [(-?|--usage)] [(-F file|--selectionFile=file)] [(-N|--no)] [(-Y|--yes)] [--[no]batch] [--cwd=directory] [--forceConfirm=[yes|no]] [-g|--gui] [--settingsUI=[gui|default]] [--status=[none|gui|default]] item id...
Description
im importcontent creates content from imported information. You can import content into at a specified location in the parent's segment structure. For example:
im importcontent --parentID=123 --field='Category=System Requirement' --field='Text=New requirement' -----insertLocation=after:34 15
creates content, inserts it after ID 34 in the relationship list for parent segment 123, and adds existing item 15 as a child for the new content.
* 
This command is normally used with an API.
Options
This command takes the universal options available to all im commands, as well as some general options. See the options reference page for descriptions.
--field=value
specifies a field and its value, where value is of the form "fieldName=fieldValue", for example, --field=Severity=Critical. If the field is multi-valued, value is of the form "fieldName=fieldValue,...".
To specify more than one field, specify this option for each field you want to add.
To specify a workflow and document project, project names must be preceded by a (/), for example, --field=Project=/testProject.
To specify an configuration management project, use the following syntax: --field=fieldname,server=server,project=projectname,[devpath=devpath|revision=checkpointrevision].
--addRelationships=value
adds related items, where value is of the form [FieldName]:ID[relationshipFlags][,...]. If no field name is specified, the Forward Relationships field is used.
* 
Adding a related item is only permitted if your administrator has allowed relationships for the item type.
--addSourceTrace=value
adds a trace to a source file, where value is of the form "field=scmSourceFieldName,server=scmServerName,port=scmPortNumber,file=fileName,project=scmProjectName[,devpath=devpathName][,projectRevision=revision][,start=startLineNumber][,end=endLineNumber]".
Note the following:
If you specify a configuration path for project=scmProjectName then devpath=devpathName and projectRevision=revision cannot be specified.
You cannot add the same source trace more than once. In order to be considered a new source trace, the trace must have a unique combination of the following attributes: member name, server name, server port, project, project revision, development path, revision, start line number, and end line number.
--addSourceLink=value
adds a link to a source file, where value is of the form "field=scmSourceFieldName,revision=memberRevisionID, server=scmServerName,port=scmPortNumber,[file=fileName|subproject=subprojectName|isProject],project=scmProjectName[,devpath=devpathName][,projectRevision=revision] [,start=startLineNumber][,end=endLineNumber]".
Note the following:
If you specify a configuration path for project=scmProjectName then devpath=devpathName and projectRevision=revision cannot be specified.
You cannot add the same source link more than once. In order to be considered a new source link, the link must have a unique combination of the following attributes: member name, server name, server port, project, project revision, development path, revision, start line number, and end line number.
--segmentType=type
specifies the segment type under which you want to import content if the --parentID is not specified. Required if you create content unrelated to a --parentID. Segment types are defined by your administrator.
--type=type
specifies the type of the segment. Your administrator defines segment types. This option is required if more than one segment type is allowed and the type field is not specified.
--richContentField=value
specifies a rich content field and its value, where value is of the form "richcontentfieldname=fieldValue".
To specify a link to an item by ID: <a href="mks:///item?itemid=ID">DisplayText</a>
For example:
<a href="mks:///item?itemid=4547">Part Requirement</a>
To specify a link to an item by ID and label: <a href="mks:///item?itemid=ID&label=LABEL">DisplayText</a>
For example:
<a href="mks:///item?itemid=4547&label=EDF-343">Part Requirement, Label EDF-343</a>
To specify a link to an item by ID and revision: <a href="mks:///item?itemid=ID&revision=REVISION">DisplayText</a>
For example: <a href="mks:///item?itemid=4547&revision=1.2">Part Requirement, Revision 1.2</a>
To specify a link to an item by ID and date: <a href="mks:///item?itemid=ID&asof=DATETIME">DisplayText</a> where date is in the format for your locale; such as US date formats "mm/dd/yy", "mm/dd/yyyy", or "mmm d, yyyy" with the time "h:mm:ss a".
For example:
<a href="mks:///item?itemid=4547&asof=03/25/2012 12:04:00 AM">Part Requirement, March 25, 2012 12:04am</a>
* 
In the korn shell command line interface, HTML tags must be surrounded by quotes, for example, "b>Feature Overview/b>". In the Windows command line interface (cmd.exe), the ^ escape character must precede the and > characters in HTML tags, for example, ^b^>Feature Overview^/b^>. You may need to escape nested " characters, for example,
--richContentField=Description="<a href=\"mks:///item?itemid=4547\">Part Requirement</a>"
--addAttachment=value
adds attachments, where value is of the form "fieldName,path=pathToFile[,name=nameOfAttachment][,summary=shortDescription] " .
* 
The "pathToFile" must include the path and filename. The "nameOfAttachment" is optional, and gives the attachment a different name than the name of the file specified in "pathToFile".
For example,
addAttachment="field=Attachments,path=c:/temp/notes.txt,name=notes123.txt,summary="Notes for item 123""
adds the existing notes.txt file as an attachment with the name of notes123.txt.
If you do not specify the name of the attachment, the file name is used as the attachment name. You can use this option multiple times to specify multiple attachments. A segment or node cannot have more than one attachment with the same name.
* 
Attachment size limits are set by your administrator. The default attachment size limit is 4 MB.
--subInsertMode=[reference|include]
specifies how subdocuments are inserted when content is imported into a document. The available options are Reference or Include. Reference inserts a subdocument but document contents are not visible in the tree structure; a subdocument must be opened in order to manage its contents. Include exposes all contents as if they were a sequential part of the parent document. You can only reference or include all content at the same time. The default is Reference. The options are as follows:
reference imports content as reference only.
include imports content as included subsections.
For example:
im importcontent --type=Node --field='Category=Heading' --subInsertMode=reference 57
creates a new node 60 and inserts a reference to document 57 beneath 60.
--parentID=value
the ID of the parent segment or node that will contain the reference to the node being imported. This option is required.
--insertLocation[=number|first|last|before:name|after:name]
determines where the content should go in the parent segment's structural relationship list. This option is required if you specify a --parentID. You cannot use this option without specifying a --parentID. The options are as follows:
first inserts the content at the beginning of the list
last inserts the content at the end of the list
before:name inserts the content before the specified ID
after:name inserts the content after the specified ID
[0,...] inserts the content at the specified location. If a negative is specified, the content is inserted at the beginning of the list. If the number specified is too large, the content is inserted at the end of the list.
item id...
the ID(s) of content you want to import into an existing segment or node. Use a space separated list to specify more than one item ID, for example, 240 241 242.
See Also
Commands: im createcontent, im importsegment
Miscellaneous: diagnostics, options, preferences