Read Drive files inside sharepoint 2013 - sharepoint

I want to read files from server drive inside share point page using page viewer web part, please help.

You need to write an ASP or .NET page that runs on the server that runs the code and point your page viewer web part to that. This page will likely be something you have to set up through the IIS on the server rather than through SharePoint. Here's a Stack article about someone who did that with ASP & C#.

Related

SPSolution Pages: Where are they found?

I am currently training on sharepoint and have few weeks experice with regards to development in sharepoint. My current task involves deploying a .wsp solution on a server farm, and did that using the powershell through the Add-SPSolution, Install-SPSolution, and did that successfully. The problem I am encountering is that in the spsolution I had a webpage named TestPage.aspx, I cant find where the page is residing such that I can access it. there a specific place where the page resides or any command which I can use?
Visual Studio usually creates a folder for application pages, so you may try:
http://server/site/_layouts/foldername/TestPage.aspx
where foldername is the name of your project/solution.
If you get "The resource cannot be found" - HTML 404 error, the site is not there.
Otherwise, even if it says "An Unexpected error has occurred" it does not mean the site is not there.
The site may exist, but has some errors. In that case the best way would be to check Windows Event Viewer and logs.
You cannot just add an aspx file and deploy on sharepoint.
Maybe what you are after is how to deploy an application page, an application page sits at the application level, so every site collection will be able to access it.
How to deploy an application page:
To add an application page do the following:
create a new empty sharepoint project
add "Sharepoint "Layouts" Mapped Folder to the project
in layouts folder create a folder (usually the name of the project)
add an application page to that folder.
that application uses sharepoint masterpage, put some content in.
Deploy using visual studio or compile and deploy the wsp using the method above
access the page in /_layouts/foldernamed/test.aspx*
If you are looking only to add some content to a sharepoint page, then I suggest you use a visual web control. it is basically a user control wrapped in a webpart. After deployed you can add it to a webpart page that you can create using the Sharepoint UI.

Using Office Web Apps, Can you open a document via webdav?

We're in the process of converting a legacy desktop application into a web enabled equivalent.
However one feature is causing difficulty, editing MS Word documents.
Current proposed solution is publishing the DOC and DOCX files via WebDAV and using a custom ActiveX component to launch WinWord and pointing it at a file via a URL.
This works but it's limited in scope and the worlds moved on since it was conceived.
Is is possible to use the new Office Web Apps to do this completely in-browser?
So, still publish DOC files via WebDAV, but only to a web server hosting the Office Web Apps and redirecting the user to a URL rather than launching a local windows exe via activex.
Can you do this with the new Office Web Apps?
Where is the documentation on how to achieve this?
Yes, you can launch editing of MS Office documents from a web browser, using the sharepoint dll available in IE:
Eg
Set EditDocumentButton = CreateObject("SharePoint.OpenDocuments.3")
strDocument = 'http://localhost:8080' + strDocument;
EditDocumentButton.EditDocument(strDocument)
If your server is running java you can use Milton (http://milton.io) to integrate directly into your business app and edit the document in place.

Why don't we use server side code in the customized pages of site pages

There are two types of pages in sharepoint. Application and site pages. In site pages if we want to customize them, are we not able to use the server side code? If so why? I saw an article related to this in MSDN.
Generally what is meant by customized here. Adding a webpart through the code is customization? Please explain me any one.
Without a web.config modification (not recommended), Site Pages do not support server side code (either inline or in a code behind file). This is primarily for security and performance reasons. Unlike Application Pages, Site Pages can be added or modified in SharePoint Designer and, in a limited fashion, through the browser.
Normally, there are many more users with these privileges than those users that have access to the web server. I'll leave it to your imagination to consider some of the insecure or inefficient server side code some of these users could create.
In addition to custom web parts, see Where's the code-behind for sharepoint aspx pages? for server side code options within Site Pages.
When you're doing application page, you're storing the aspx with the 12 / 14 hive (SharePoint installation directory) and you're free to use any code behind class / component that you want to use. The original aspx file will stay in the physical folder of the Web Frond End
On the other side, when you're creating site pages, you're adding a new entry within the content database and not on the file system. Even if you have a site page template, you need to add safe entries to your web.config to trust the assemblies.
For the site pages, it is suggested to work with WebParts. They will allow you do do any business / core logic with the actual page, list, web, site.
When they talk about customization, they talk about modification done to the site pages that will alter the original definition. A site page provisioned through a web definition will stay "uncustomized" (ghosted) in the file system until it is being edited.

Sharepoint Site using PHP code

I realise that Sharepoint in asp .net based but I have a PHP application that a user wants me to include in a Sharepoint site.
So is it possible to use PHP code inside sharepoint?
danit, when you say 'include' in the site, would it mean to be part of the site chrome (like inside the same menus etc) or just live connected with links would suffice?
I ask that because you can run php code under an IIS site but that would only keep the pages separated inside the same virtual host. if you need to actually join the functionalities you can:
Fake it with an iFrame (Page Viewer Web Part pointing to the php site for example).
you'll have to use some interop like webservices. It really comes down to what you want to do and not to if it is possible.
This is also possible by creating a web part page and adding a page viewer web part. You can link to the page, making it visible within the Sharepoint site, but it won't offer any interaction with Sharepoint itself.
Sharepoint treats the page as a shared document, however, so you can restrict access to it. I have done this in order to offer access to 'view only' content such as reports, but you can also use it for custom php apps that rely on a database other than the one(s) Sharepoint is using.

How to locate Sharepoint document library source page on the server?

I am working with a Sharepoint document library and I'm trying to locate the source of the document library page. I'm working on the Sharepoint server. I just can't find it, where should it be stored?
Thank you!
SharePoint does not store the pages directly in the filesystem. The mechanism is a little less straightforward.
To understand this mechanism, You have to understand the concepts of Ghosting/Unghosting, and the ASP.NET Virtual Path Provider. The SharePoint stores the pages in the Database as BLOBS, and serves them up using the ASP.NET Virtual path provider.
The ASP.NET Virtual Path Provider provides an abstraction between ASP.NET and FileSystem. Instead of getting a System.IO.FileStream object directly from the filesystem, the provider uses MapPathBasedVirtualPathProvider and the MapPathBasedVirtualFile classes to get the FileStream object.
This abstraction allows ASP.NET to serve up pages from anywhere, without having to store the pages in an actual file system. This concept is used to implement Ghosting/Unghosting which basically means having a single copy of the page, and serving them up as different pages.
SharePoint leverages this new feature in ASP.NET 2.0, along with the improved BLOB storage functionality in SQL Server 2005 to serve up pages.
Your question is not very clear...
Are you refering to the "source" code of the document library pages?
It depends if you have edited them with SharePoint Designer or not. If not they should be located under 12 hive (c:\program files\common files\microsoft shared\web server extensions\12). If any modification were done using SPD2007 the files will be stored in the content database.
...or are you refering to the "source" where the files are stored?
All the files saved in document libraries are stored in the content database as blobs in the AllUserData table.
You the pages appear as 'aspx' pages, they are not stored on the server anywhere as aspx pages. All pages are either stored in the DB as a BLOB, or 'put together' at runtime from information stored in the DB. SharePoint is an odd monster :)
If you are going to edit the look, there are a few options:
SharePoint Designer (I hate this app)
Make another 'web part page' that includes the document library inside of it while changing the content around it (easiest and best approach IMO)
make a specialized web-part (most
difficult)
SharePoint takes a whilet o get the full grasp of... it is strange.
When you create a document library template files from the "12 hive" are ghosted into the SharePoint content database (SQL). The only proper way to edit those pages at that point is to use Microsoft SharePoint Designer.
Open SharePoint Designer and open the SharePoint web site in question and you will see your document library listed in the file explorer. Under your document library you will see a Forms folder, that Forms folder is what contains the source files that are rendered to the browser.
Here is a screen shot:
If I understand what Sacha and Naspinski are saying, when I am creating a new Document library, the look of the page is retrieved from the 12 hive and stored (ghosted?) into the DB. The page is no more stored into the 12 hive, as for each document library I will have a somehow "customized page". Is that true?
There are two types of pages in SharePoint2010.Application page and site page.SharePoint store application page directly in File system.For site pages , if the page is in a ghosted state , the page in stored in the file system.If the page has been customized,the file is then stored in the content database.

Resources