簡體   English   中英

檢查服務器C#Office加載項上是否有Power Point文件

[英]checking if there is a power point file on the server c# office add-ins

我有一個疑問,我正在研究應該進入服務器的代碼,並檢查是否存在PowerPoint文件。

該代碼可以正常工作,但問題是:我不知道PowerPoint文件的確切名稱。

我使用以下代碼:

string test3 = @"http://bitnet/portfolio/Salesunterstuetzung/Kurzprofile/Abegg,%20Frank/BridgingIT_Kurzprofil_Frank_Abegg_20160803.pptx";
                WebClient r = new WebClient() { UseDefaultCredentials = true, Proxy = null };
                string content = r.DownloadString(test3);
                if (content == "") MessageBox.Show("wrong");
                else MessageBox.Show("right");

代碼正在工作。 它返回“正確”。 但是如何編輯它以接受“ .pptx”文件的任何名稱。

非常感謝你。

經過三天的工作,我終於找到了解決方案:

閱讀文件夾鏈接並帶入內容,然后在內容內部搜索字符串。

string test3 = @"http://bitnet/portfolio/Salesunterstuetzung/Kurzprofile/Abegg,%20Frank/";
                WebClient r = new WebClient() { UseDefaultCredentials = true, Proxy = null };

                string content = r.DownloadString(test3);
                if(Regex.Matches(content, ".pptx") != null)
                {
                    MessageBox.Show("right");
            }

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM