The G4MSUPLOAD command is used to upload a file from your IBM i (AS/400, iSeries, etc) Integrated File System (IFS) to your Microsoft OneDrive.

                      Upload File to MS OneDrive (G4MSUPLOAD)   
 Type choices, press Enter.
 MS ID  . . . . . . . . . . . . .   _______________________________________________________
 File to upload . . . . . . . . .   _______________________________________________________
 File name  . . . . . . . . . . .   *DFT
 File content type  . . . . . . .   *DFT
 Upload to folder . . . . . . . .   *ROOT
 Replace file . . . . . . . . . .   *YES          *YES, *NO
 Choose new name  . . . . . . . .   *NO           *YES, *NO
 Search method  . . . . . . . . .   *NET          *NET, *FILE
                            Additional Parameters                              
 CCSID  . . . . . . . . . . . . .   1252          Number
 Debug  . . . . . . . . . . . . .   *NO           *YES, *NO
 Debug File . . . . . . . . . . .   ______________________________________________________
 F3=Exit   F4=Prompt   F5=Refresh   F12=Cancel   F13=How to use this display   
 F24=More keys                                                                 
  • Microsoft ID - Enter the Microsoft ID associated with the drive you wish to upload to.
  • File to upload - Specify the fully qualified path to the file on the IFS that you wish to upload.
  • File name - Enter the resulting filename you would like to use when the file is placed in your Microsoft OneDrive. The value of *DFT will use the file name (without the path) of the file you are uploading.
  • File content type - Enter the content type of the file you are uploading. The value of *DFT will attempt to look up the content type in the G4MSCTTPF file. Please check this file for the file extension and associated content type if you are unsure of what will be used.
  • Upload to folder - Specify the path on your Microsoft OneDrive you wish to place this file. This parameter IS case sensitive. The value of *ROOT will place the file in the root of the Microsoft OneDrive (also named /SkyDrive). It should be noted that OneDrive creates some default folders. One of them is named "Pictures" and has a type of "Album". Uploading to these types of "Album" folders is not supported.
  • Replace file - Specify *YES to replace the file if it already exists.
  • Choose new name - If the file exists and Replace file is set to *NO, this will instruct OneDrive to give the file you are uploading a new name. If this value is *NO and Replace file is *NO the file will not be uploaded.
  • Search method - Specify *NET to search for the ID of the folder the file will be placed in by traversing the up to date folder structure online. Specify *FILE to find the ID of the folder by looking in the G4MSDRVPF file. Using *NET will be slower, especially for deeply nested folders but it will be the most accurate. Using *FILE will be much faster in finding the ID but it also could be out of date if you haven't use the G4MSLSTFIL command lately to keep it up to date.
  • CCSID - Enter a CCSID for data translation.
  • Debug - Enter *YES to debug this command.
  • Debug File - Enter the fully qualified path and name of the IFS file to store the debug data. If left blank the default of /tmp/g4ms_<id>_upload.txt will be used where <id> is the ID associated with the request.

Example of Uploading a File to your Microsoft OneDrive

First, prompt the G4MSUPLOAD command and enter your Microsoft ID, the fully qualified path and file to upload as well as the fully qualified path of the directory you want to place the file into on your Microsoft OneDrive. The OneDrive path IS case sensitive.

In this example, we will upload a file from our IFS named /tmp/test.pdf to the /Documents folder in our OneDrive.

G4MSUPLOAD ID(bvstone@outlook.com) STMF('/tmp/test.pdf') TOFLR('/Documents')

If the command completes normally, you should now see the file available in your OneDrive folder:

If you want to have more than one copy of the file, unlike Google Drive, Microsoft OneBox doesn't allow two files with the same file name on the site. Instead, you can either specify a new file name when uploading or you can tell OneDrive to automatically rename the file:

G4MSUPLOAD ID(bvstone@outlook.com) STMF('/tmp/test.pdf') TOFLR('/Documents') REPLACE(*NO) CNEWNAME(*YES)

When done, you will notice the new file, in this case "test 1.pdf":