We have a sharepoint doucment library, the site consist media files(like images, word document, .psd file) and then we have a local CME (Alterian) which can be integrated to the SharePoint library in order to share the document library but the site needs to be on http// not an https//, coincidentally current sharepoint site is on https//, so we need to figure out a way/write a module which will work as a scheduled job (possibly using SPJobDefination class) and check on https// site for recently modified/added or deleted documents/records and then will copy them/normalize them to a dev site (hosted on http//, replica of the production https// site).
Experts please share your view's to proceed with a best approach to make this happen. (At an initial stage I'll have to copy over all the existing meta-data from the current https// site aswell)
Thanks a lot in advance for the time.
I would use event handlers on the https document library. Please see the SPItemEventReceiver.ItemAdded Method and SPItemEventReceiver.ItemUpdated Method.
So, every time you will add or modify an item, the code inside the methods is triggered. Inside the code, you may take the library document and copy it to the http site.
Regarding the existing items, you could write a simple console application which will copy the items from one list to the other.
Make sure that you make use of the SPListItem.SystemUpdate Method.
Also, the following excerpt from an answer to the question Moving Documents from library to library deletes version history, how do you retain it? could be helpful for starting:
(...) We can get the “SPFile” and the “SPFileVersion” objects from the
original library and add them to another library one by one. After
copying a file or version, get the original custom property form the
source file or version and use the “SPListItem.SystemUpdate(false)”
method to update the target file or version. This workaround can
persist most of the properties except the “modified time” or “modified
by” field. (...)
Related
I am making a C# program that recreates websites in offline mode for use at computers within the company, that are not connected to the internet. These offline websites are identical to their online versions, with all content displayed.
I already have a solution for websites with simple MySQL access, but I need to rewrite the program, so that it can handle Drupal based websites aswell. However, I couldn't figure out how to access Drupal's SQL database, or even what to look for.
The original program uses the website's templates (that are already rewritten in HTML), and places the data mined out of it's database in the templates. Problem is, I don't know where to look for Drupal's templates, or if there aren't any, what data should I gather from it's database.
I use MySQL Connector to reach the database with C#. Should I look for the nodes? If yes, where?
If you want to go down that path you will have to sort of act like Drupal, in order to know which things to read from where. Each module installed has their own tables and functions in a particular way, so not always all the data are nodes with fields.
I you need to work with websites in offline mode, I would suggest using a portable webserver, that way you just copy the website to the root folder and run a script to copy the MySQL database as well, the point being that it's portable, you can carry it around in a flash drive and to run it, you don't need to install anything.
Again, what you want to do is possible, but it will require a tremendous amount of work and you cannot guarantee that things will behave well when you install new modules.
Another approach would be to look into the Boost module, which creates offline, static files based on the request you make to the site, and stores them in a configurable folder.
Another way: build a screenscrapper which reads the HTML from the homepage, and recursively follows the links and modify them before saving the HTML yo your local copy.
Summing it up.. avoid accessing the database yourself and try to read the HTML already rendered.
We're having a restructuring on our application and currently the idea is to break the codes into Core library codes + customized codes for our developer.
I'm thinking of the possibility to have a folder (i.e. 'custom') that is empty by default, and when the developer need to customize any codes either from existing asp pages or new pages, they just need to put them into the folder and it will work. Example:
Lets say core folder store the default asp pages.
core\customer\createCustomer.asp <-- the default page
And when the developer want to overwrite that page, he needs to copy that asp page to the custom folder, like
custom\customer\createCustomer.asp <-- modified asp page
The application will automatically load the one in the custom folder rather the one in the core folder.
Is this doable in C#?
This MSDN article explains how to use an IHttpModule implementation to intercept HTTP requests and perform custom actions (they point out logging, but since you're intercepting the request you might as well fetch some different content, such as your 'customized' code).
You can use a VirtualPathProvider to load a different file than the "actual requested one". This works well with IIS and caching for instance as well.
Basically you inherit the VirtualPathProvider and override the FileExists, GetFile, and DirectoryExists, GetDirectory methods (there's an example in the linked page). Then, in your AppInitialize, register the provider with
HostingEnvironment.RegisterVirtualPathProvider(sampleProvider);
By the way, don't forget to have a different (non-editable) page so the user can revert any changes that was made, in order to restore a potential misedit so to speak. I would probably have a simple version control system and use commit whenever the user made changes, and allow the user to revert to a previous changeset.
What I need to do is quite simple although is causing me lots of trouble.
I need to create programmatically an AssetUrlSelector in a web part that selects a file in sharepoint 2010 and makes its path available to be used elsewhere.
So far I have managed to create the AssetUrlSelector and display the path on a textbox, however I cannot use this as every reference to it will be null.
Have you got any practical example?
Try the Document ID Service. In short this service generates IDs for documents (files) and generates an url with this ID so even if the file is moved the url stays valid and the service returns the document. This service might rely on search functionality unless you implement your custom search. Here is an article on how to configure OOB Doc IDs here. Also you can google further if you're interested.
As part of the development for a website powered by Sitecore 6.3.1, I will need to implement a way to manage data from a couple of external sources in Sitecore.
To accomplish this, the simplest solution appears to be to import the external data into Sitecore as content items with a special workflow that will export them back to the external data source when they reach the final state.
I came across this article which details the code required to import data into Sitecore, but I am uncertain as to the best way to make this functionality accessible.
Considering that this process will probably (but not certainly) only be done once after the site is completed, what approach (page/Sitecore item/shell application/?) could I take to provide a way for a developer user to perform the import?
Interestingly, the Sitecore classes are available even in web forms outside of Sitecore. I created a separate .aspx file and used Sitecore.Data.Database.GetDatabase("master") to interact with Sitecore's database.
I'm currently investigating SharePoint for our company as a means to make Excel processing accessible through our web application without relying on the Office Interop DLL files. (our sysadmin doesnt want to install Office on the production server, for good reason)
I'm aware that Sharepoint has an Excel Webservice that can be enabled and used by the application. The problem, if it is a problem, is that I need to make a class that wraps all the logic for transforming an Excel into HTML.
So I need to add the references to this webservice to the application.
But what if we need to deploy the application with a customer that has no SharePoint server available, will this cause a problem in the application? We will use checks to make stuff visible and invisible depending on whether a parameter is set, but I'm looking for a means to ensure that I can for example add the required references at runtime when I need them for Sharepoint.
I hope the question is clear.
I'm not sure I understand you completely, but if you're just wondering about changing the URL of a web service(From say http://companyA.co/service.svc?wsdl to http://compB.co/serv.svc?wsdl), depending on where it is, that's easy as pie in .Net, basically just:
service.URL = "http://localhost:51112/Service1.svc?wsdl";