本文介绍了文档库(文件上传)-转义特殊字符的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

你好

在我们的环境中,我们有一个包含标准文档库的网站集.

in our enviroment we have a site collection containing a standard document library.

在此文档库中,我们希望上载word文件,但是其中一些文件包含特殊字符.重命名所有这些文件将花费很多时间.所以我想做的就是在文件上传时转义这些字符.

In this document library we would like to upload word files, but some of these files containing special characters. To rename all these files would take much time. So what I would like to do is to escape these characters, when the file is being uploaded.

我已经通过ItemAdded方法(将同步"设置为同步",但尝试了找不到文件"错误)进行了尝试.使用以下代码:

I've tried it via the ItemAdded method (with Synchronization set to "Sychronous", but this results in a "File not found" error. Used the following code:

        public override void ItemAdded(SPItemEventProperties properties)
        {
            base.ItemAdded(properties);
            properties.ListItem["Name"] = "ReplacedName";
            properties.ListItem.Update();
        }

有人可以帮助我吗?

预先感谢.

推荐答案

itemadded事件不会触发.

itemadded event wont fire in those scenarios.

可以请您检查以下内容.

Can you please check the below.

https://social.technet.microsoft.com/Forums/windows/zh-CN/e8c4eaf0-6ba6-4182-b770-0d94c413f01b/autoremove-special-character-from-file-name-when-uploading-to -sharepoint-2013?forum = sharepointgeneral

https://social.technet.microsoft.com/Forums/windows/en-US/e8c4eaf0-6ba6-4182-b770-0d94c413f01b/autoremove-special-character-from-file-name-when-uploading-to-sharepoint-2013?forum=sharepointgeneral

https://social.technet.microsoft.com/Forums/zh-CN/4a9fac2e-d274-4a35-b5ed-a7d479057990/rename-files-while-uploading-having-special-characters-in-file-name ?forum = sharepointdevelopment

https://social.technet.microsoft.com/Forums/en-US/4a9fac2e-d274-4a35-b5ed-a7d479057990/rename-files-while-uploading-having-special-characters-in-file-name?forum=sharepointdevelopment


这篇关于文档库(文件上传)-转义特殊字符的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-05 18:35