none
special character "French character" in sharepoint folder RRS feed

  • Question

  • Hi;

    I have a script which create from CSV file of the folders into a sharepoint doc lib but some folder name contains  a french special character named for example "Février" or "Accès".

    Its possible to create the folders with theses special characters in using powerShell :

    My code is :  $Subfolder = $Folder.SubFolders.Add($FolderName)

    Regards

    Wednesday, November 25, 2015 9:02 AM

All replies

  • Hi,

    We can use PowerShell to achieve it. The following PowerShell script for your reference:

    $webUrl = "http://sp" $listName = "Shared Documents" $folderNamePrefix = "Février"; $subFolderName="Accès"; # Open web and library $web = Get-SPWeb $webUrl $list = $web.Lists[$listName] # Create root folder $folder = $list.AddItem("", [Microsoft.SharePoint.SPFileSystemObjectType]::Folder,$folderNamePrefix) $folder.Update()

    # Create subfolder in the root folder. $rootFolder = $list.RootFolder.SubFolders.Item($folderNamePrefix); $subFolder = $list.AddItem($rootFolder.ServerRelativeUrl, [Microsoft.SharePoint.SPFileSystemObjectType]::Folder, "$subFolderName") $subFolder.Update() #Dispose web $web.Dispose()

    Best Regards,

    Dennis


    TechNet Community Support
    Please remember to mark the replies as answers if they help, and unmark the answers if they provide no help. If you have feedback for TechNet Support, contact tnmff@microsoft.com.

    Thursday, November 26, 2015 7:32 AM
    Moderator
  • Hi Dennis;

    Ok but when the folder is created : the character é or è are transcode by sharepoint  with a special symbol  ?

    Regards

    Thursday, November 26, 2015 9:19 AM
  • Hi,

    Please see the following screenshot about my tested result in my test environment.

    The character é or è doesn't transcode by SharePoint.

    Best Regards,

    Dennis


    TechNet Community Support
    Please remember to mark the replies as answers if they help, and unmark the answers if they provide no help. If you have feedback for TechNet Support, contact tnmff@microsoft.com.

    Thursday, November 26, 2015 9:33 AM
    Moderator
  • Hi Dennis

    For my its Ko  I have : �tablissement for établissement ?

    My script is :

    foreach ($proc in $Folders)
       {
         if ($proc.processus -ne "")
         {
          foreach ($processFolder in [Microsoft.SharePoint.SPFolderCollection]$dotcFolder.SubFolders)
          {
           if ($processFolder -ne $null)
           {
             if($processFolder.Name -eq $proc.processus)
             {
              $out = "Le folder $processFolder exists! =======> " +  $dotcFolder.Name
              $out | out-file $traceFile -append
              $FolderExists = $true
              break;
             }
           }
           else
           { $FolderExists = $false}
          }
          if ($FolderExists -eq $false)
           {

            $dossier = $dotcFolder.SubFolders.Add($proc.processus)
           }
         }
       }




    • Edited by soussou97 Thursday, November 26, 2015 10:08 AM
    Thursday, November 26, 2015 10:04 AM
  • Hi dennis;

    can be make a cast in string for the $proc.processus variable because If it dispalys with write-host $proc.processus then the value is equal to : ?tablissement

    Regards


    • Edited by soussou97 Thursday, November 26, 2015 10:47 AM
    Thursday, November 26, 2015 10:46 AM
  • Hi;

    The problem is caused in reading the values from a CSV file : the folders names are reading into a CSV file.

    Its possible to change these values in string into my script ?

    regards

    Thursday, November 26, 2015 5:13 PM
  • Hi

    to avoid this issue use this command

    import-csv .\tt.csv -Encoding Default

    The differences are in the image bellow


    Romeo Donca, Orange Romania (MCSE, MCITP, CCNA) Please Mark As Answer if my post solves your problem or Vote As Helpful if the post has been helpful for you.

    Thursday, November 26, 2015 8:16 PM
  • Hi Romeo;

    OK but I'am with a old version of the powershell Because I have the following error when I add the parameter 'encoding" :   Import-Csv : Impossible de trouver un paramètre correspondant au nom « Encoding »

    Any idea (another solution) ?

    Regards

    Thursday, November 26, 2015 9:52 PM
  • Hi,

    Any update? Please upgrade the version of PowerShell or try to  convert your csv file to UTF-8.

    Best Regards,

    Dennis


    TechNet Community Support
    Please remember to mark the replies as answers if they help, and unmark the answers if they provide no help. If you have feedback for TechNet Support, contact tnmff@microsoft.com.

    Tuesday, December 1, 2015 6:51 AM
    Moderator