On premise document import

Oct 18, 2016 at 7:11 PM
Mapping metadata fails. The cells in the spreadsheet are set to text and the fields names match. the docs go in but without metadata:
ImportMappings>
<!-- Map Metadata --> <ImportMapping xsi:type="ImportMapping_String">
<DestinationField>UserTitle</DestinationField>
<SourceColumn>UserTitle</SourceColumn>
</ImportMapping>
<ImportMapping xsi:type="ImportMapping_String">
<DestinationField>Created By</DestinationField>
<SourceColumn>CreatedBy</SourceColumn>
</ImportMapping>
</ImportMapp

I also get the Exception importing : \pcname\aaa\a.doc : file not found but it is finding the doc and the spreadsheet because the doc ends up in sharepoint

Thank you for looking at this.
Coordinator
Oct 19, 2016 at 8:59 AM
Sorry to hear that you are having problems.

I would suggest the following.
  1. Check that you are using correct import mapping. "Created By" in SharePoint is, from recollection, a user field. String will not work for this you will need to user ImportMapping_User.
  2. Check that DestinationField is resolvable. This can be the display title of the field but is that is not working then try the internal name of the field.
  3. Check the log to get some more detail. To do this edit difs.exe.config in the directory to which DIFS is installed. If you still cannot solve the problem please can you post any relevant sections of this log.
Add the autoflush.

Ensure that initialise data points to a location that you can write too. If you leave this as a location like "program files\difs" then you may need to "Run as Administrator"
<?xml version="1.0"?>
<configuration>
    <configSections>
    </configSections>
<startup>
  <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0"/>
</startup>
  <system.diagnostics>
    <trace autoflush="true"/>
    <sources>
      <source name="SPImportHelper">
        <listeners>
          <remove name="Default"/>
          <add name="eventlog"
              type="System.Diagnostics.TextWriterTraceListener"
              initializeData="c:\temp\SPImportHelper.log">
            <!--
            <filter type="System.Diagnostics.EventTypeFilter" initializeData="Information"/>
            -->
          </add>
        </listeners>
      </source>
    </sources>
  </system.diagnostics>
</configuration>
Oct 19, 2016 at 6:52 PM
Hello,

I tried your suggestions by 1. commenting out "create user" 2. located the internal name: ___{"Name": "UserTitle",
"FieldType": "Text",
"RealFieldName": "UserTitle",
"DisplayName": "UserTitle",
"ID": "f8e1fdad-0e22-468a-a9de-bf207a5b6d5e",
"Type": "Text",
"AutoHyperLink": "TRUE",
"AllowGridEditing": "TRUE"}
],"LCID" : "1033","Userid" : "1"
,"PagePath" : "/Templates/Forms/AllItems.aspx"
,"ShowWebPart" : ""
,"View" : "{2478F11D-70A4-4175-B9FF-AB42EE949AAC}"
,"RootFolderParam" : "View={2478f11d-70a4-4175-b9ff-ab42ee949aac}&"
,"FieldSortParam" : ""___
and verified I was using the right field name and cast.
And 3. added lines to difs.exe.config but the log remains blank. I also tried to recreate the list column in sharepoint and tried reinstalling DIFS. I changed the cell setting in excel. I also tried to run as administrator. I created a folder at the root of C: called DIFS and put all the files there.

Any help is greatly appreciated.
Coordinator
Oct 20, 2016 at 6:25 AM
Ok

1. Running as administrator should with that auto flush setting should populate the log

2. The column should be part of content type I.e user title belongs to content type my type,your list allows my type and the import spreadsheet is setting to my type

3. Is created by still not working?

Coordinator
Oct 21, 2016 at 12:52 PM
Ok so setting read only field Created By (internal name author) might be causing your problem.

I did the following and it work perfectly with / without content types enabled.

This config
<?xml version="1.0" encoding="utf-8"?>
<DataSetImportSettings xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
  <Source>
    <SourceDataSetType>OLEDbSelect</SourceDataSetType>
    <OleDbSourceDataSetSettings>
      <ConnectionString>Provider=Microsoft.ACE.OLEDB.12.0;Data Source=\\vmware-host\Shared Folders\Projects\ProductDevelopment\ImportForSharePoint\WorkingArea\Examples\ListColumn.xlsx;Extended Properties="Excel 12.0 Xml;HDR=YES;IMEX=0";</ConnectionString>
    </OleDbSourceDataSetSettings>
    <OleDbSelectSourceDataSetSettings>
      <SelectStatement>select * from [files$]</SelectStatement>
    </OleDbSelectSourceDataSetSettings>
  </Source>
  <Destination>
    <AuthenticationSettings>
      <AuthenticationType>Current</AuthenticationType>
      <domain />
      <username />
    </AuthenticationSettings>
    <DestinationItemSettings>
      <DestinationItemType>Document</DestinationItemType>
      <ItemExistsBehaviour>Overwrite</ItemExistsBehaviour>
      <ImportMappings>
        <ImportMapping xsi:type="ImportMapping_String">
            <DestinationField>UserTitle</DestinationField>
            <SourceColumn>UserTitle</SourceColumn>
        </ImportMapping>
        <ImportMapping xsi:type="ImportMapping_User">
          <DestinationField>MyCreatedBy</DestinationField>
          <SourceColumn>Created By</SourceColumn>
        </ImportMapping>        
      </ImportMappings>
    </DestinationItemSettings>
    <DestinationListSettings>
      <DestinationWebUrlRelative>/sites/SPImportHelper</DestinationWebUrlRelative>
      <DestinationFolderUrlRelative>/sites/SPImportHelper/Shared%20Documents</DestinationFolderUrlRelative>
      <DestinationServerUrl>http://productdev</DestinationServerUrl>
      <DestinationListName>Shared Documents</DestinationListName>
    </DestinationListSettings>
    <SourceColumns>
      <SourceFileNameAndPath>FullName</SourceFileNameAndPath>
      <ContentType>ContentType</ContentType>
      <DestinationSubFolder>DestinationSubDirectories</DestinationSubFolder>
      <DestinationFileName>DestinationFileName</DestinationFileName>
    </SourceColumns>
  </Destination>
</DataSetImportSettings>
Using source;

DestinationFileName ContentType UserTitle Created By
Contract.txt Document Contract testmember01
Promotion.txt Document Promotion testmember01

This sets a field "MyCreatedBy" which is a "Person" field.

If you do what to set the out of the box "Created By" field.
#Add the SharePoint snapin
Add-PSSnapin Microsoft.SharePoint.Powershell -ea SilentlyContinue
 
#set the web url and the list name to work upon
$url = "http://productdev/sites/SPImportHelper"
$listName = "Shared Documents"

 
#Get the appropriate list from the web
$web = get-SPWeb $url
$list = $web.lists[$listName]
 
#Get the file using the filename
foreach ($item in $list.items)
{
    # Created By
    $item["Author"] = $item["MyCreatedBy"].ToString();
    # Modified By
    $item["Editor"] = $item["MyCreatedBy"].ToString();
    $item.UpdateOverwriteVersion();
}
Oct 21, 2016 at 1:13 PM
Edited Oct 21, 2016 at 1:14 PM
Hello, Thank you for sticking with this. I completely removed the “created by” mapping. I have not made the jump to content types so the columns are created per site. I have tried to recreate the columns and changed the Import template. I tried to change user rights although mine are domain admin and site admin. I have been trying to learn the xsi:types and to understand how they are used and called. I am an admin, not a developer but I am trying because I don’t have any developers on staff. Thanks again for your help! This seems to be a great tool!
Coordinator
Oct 21, 2016 at 1:26 PM

No problem here to help.

I was unsure from your message whether things are working or otherwise since your post had some attachments that did not arrive (Codeplex) will take these out.

In you need to send some screenshots just click on the “MadAboutImport” name and in my profile click “Contact” and send me a private message with your email address.

We can then send attachments and configs around more easily.

Oct 21, 2016 at 1:29 PM

I added attachments and screenshots but I don’t think they made it. It is not able to add any metadata but the doc load with the name. Is there a way to send you files?

From: MadAboutImport

No problem here to help.

I was unsure from your message whether things are working or otherwise since your post had some attachments that did not arrive (Codeplex) will take these out.

In you need to send some screenshots just click on the “MadAboutImport” name and in my profile click “Contact” and send me a private message with your email address.

We can then send attachments and configs around more easily.