亚洲免费在线-亚洲免费在线播放-亚洲免费在线观看-亚洲免费在线观看视频-亚洲免费在线看-亚洲免费在线视频

Deploying files using Mapped Folders

系統 1599 0

With Visual Studio 2010 SharePoint Developer Tools, the concept of the Mapped Folder was introduced. A mapped folder is a convenient way for developers to specify a location for any files that need to be deployed on to the SharePoint file system, all from within in a Visual Studio solution. Mapped folders can be included as part of a deployment package (.WSP) and the files will get copied to the correct location when the WSP is installed on to the server.

Let’s take a quick look at how a developer might use a mapped folder. Say a developer wants to develop a custom application page for their SharePoint site that will consume a custom image. The SharePoint server has a designated location for both application pages and images. With mapped folders, the developer can ensure that their files will be deployed to the correct location. Here’s an example:

First we need to create a project. In this example, we will start by creating an Empty SharePoint project (Installed Templates->Visual Basic/C#->SharePoint->2010).

Deploying files using Mapped Folders

Next, we’ll create our custom image that we want to display. First, let’s setup a mapped folder to the Images directory on the SharePoint farm. To do this, we simply right-click on the project node and select “Add->SharePoint “Images” Mapped Folder”:

Deploying files using Mapped Folders

This will create a mapped folder named “Images” in our project. (You can also create it via the “Project->Add SharePoint “Images” Mapped Folder on the main menu bar”)

In the Solution Explorer, mapped folders look very similar to normal folders but have a small green globe in the bottom right corner of the icon. You’ll notice that underneath the mapped folder there is a sub folder with the same name as the project. This is to help organize images specific to your project and keep developers from inadvertently overwriting another item with the same name.

Deploying files using Mapped Folders

Also, if you select the mapped folder and open the property window (F4), you’ll see two entries: Folder Name and Deployment Location. The Deployment Location indicates the location relative to the SharePoint root directory ({SharePointRoot}) on the SharePoint farm.

Deploying files using Mapped Folders

Now that we have our mapped folder, we can right-click on the project directory underneath it and add our image file (“Add->New Item’). In this example, I’ve added a bitmap image named ”Bob.bmp”.

The next step is to create the application page and modify it to show our image. To start, right-click on the project node in the Solution Explorer and select “Add->New Item”. When the Add New Item dialog appears, the “2010” node under SharePoint will be selected. From the list of templates, select the “Application Page” item, give it the name you want, and click “Add”. You’ll notice that when the application page is added to the project, it automatically gets created under the “Layouts” mapped folder, which is the default location on the SharePoint file system for application pages:

Deploying files using Mapped Folders

Following its creation, the .aspx file we just added should be opened in the designer. Locate the <asp:Content> element with the ID equal to “Main”. Within that element add an image element and set the ImageUrl attribute to point to the image in your product. It should look like this:

    
      <
    
    
      asp:Content
    
    
      ID
    
    
      ="Main"
    
    
      ContentPlaceHolderID
    
    
      ="PlaceHolderMain"
    
    
      runat
    
    
      ="server"
    
    
      >
    
    
      <
    
    
      asp:Label
    
    
      ID
    
    
      ="Label1"
    
    
      runat
    
    
      ="server"
    
    
      Text
    
    
      ="Label"
    
    
      Font-Size
    
    
      ="Medium"
    
    
      >
    
    This is Bob.......
    
      </
    
    
      asp:Label
    
    
      >
    
    
      <
    
    
      asp:Image
    
    
      ID
    
    
      ="Image1"
    
    
      runat
    
    
      ="server"
    
    
      ImageUrl
    
    
      ="~/_layouts/Images/SharePointProject1/Bob.bmp"
    
    
      />
    
    
      </
    
    
      asp:Content
    
    
      >
    
  

The last thing we’ll want to do to make testing our project easier is to set the application page to be our startup item when we F5. To do this, select the project node in the Solution Explorer and open the property window (F4). In the property window, select the “Startup Item” property and choose our application page from the drop down list. Now when we F5, it will take us right to our application page:

Deploying files using Mapped Folders

A couple of things to know about mapped folders. First, since mapped folders effectively deploy files onto the SharePoint file system, they are only allowed in farm level solutions. Sandboxed solutions are restricted to only deploying content to the content database on the server. In VS, when you try add a mapped folder to a sandboxed solution, the package validation will generate an error regarding this.

Second, as you saw when we added the application page, some items go into certain mapped folders by default when they are added to the project. Another example is User Control items (.ascx) which are automatically placed into the User Control mapped folder. While these are the SharePoint “default” locations, there may be times you need to place one of these files in a different location, and this can be done by mapping the folder to a different location.

Finally, you can create a mapped folder to any folder under the SharePoint root on the farm by opening the Add SharePoint Mapped Folder dialog (Project->Add SharePoint Mapped Folder… from main menu, Add->SharePoint Mapped Folder… from project context menu :

Deploying files using Mapped Folders

For instance, if you had a custom web service you wanted to deploy to the SharePoint server, you could simply add a mapped folder that points to the ISAPI directory on the SharePoint file system and dropped the web service in there. Then, when the package gets deployed to the server, the web service will automatically be placed in the ISAPI directory and available for consumption.

Deploying files using Mapped Folders


更多文章、技術交流、商務合作、聯系博主

微信掃碼或搜索:z360901061

微信掃一掃加我為好友

QQ號聯系: 360901061

您的支持是博主寫作最大的動力,如果您喜歡我的文章,感覺我的文章對您有幫助,請用微信掃描下面二維碼支持博主2元、5元、10元、20元等您想捐的金額吧,狠狠點擊下面給點支持吧,站長非常感激您!手機微信長按不能支付解決辦法:請將微信支付二維碼保存到相冊,切換到微信,然后點擊微信右上角掃一掃功能,選擇支付二維碼完成支付。

【本文對您有幫助就好】

您的支持是博主寫作最大的動力,如果您喜歡我的文章,感覺我的文章對您有幫助,請用微信掃描上面二維碼支持博主2元、5元、10元、自定義金額等您想捐的金額吧,站長會非常 感謝您的哦!!!

發表我的評論
最新評論 總共0條評論
主站蜘蛛池模板: 欧美色欧美亚洲高清在线视频 | 欧美交换乱理伦片120秒 | 亚洲天天做日日摸天天做 | 麻豆一区二区三区在线观看 | 成人精品一区二区激情 | 99久久综合狠狠综合久久 | 2021在线永久免费视频 | 一级网 | 四房婷婷在线视频播放 | 激情四房 | 2021久久伊人精品中文字幕有 | 成年女人毛片免费视频 | 日本日韩欧美 | 午夜精品久久久 | 深夜免费 | 狠狠色噜噜狠狠狠狠狠色综合久久 | 四虎网址最新 | 久久久久久久久久免费视频 | 欧美大片一区 | 女人18毛片a级毛片免费视频 | 538在线视频二三区视视频 | 国产精品亚洲综合一区 | 国产精品第一页爽爽影院 | 久草新免费 | 免费国产一级特黄aa大片在线 | 日本伊人色综合网 | 日本韩国欧美在线 | 香蕉免费一区二区三区在线观看 | 欧美午夜艳片欧美精品 | 日日久| 91福利视频在线 | 日本无吗中文字幕免费婷婷 | 91手机在线视频 | 国产日日干 | 免费观看毛片 | 亚洲人成一区 | 四虎久久 | 92精品国产自产在线观看 | 日日碰狠狠添天天爽爽爽 | 成人性开放大片 | 国产精品五月天 |