how to deploy a C# code to sharepoint 2007 - sharepoint

in SharePoint 2007 (moss)
i need to implement a button . a button to create a custom action. this custom action registers a JavaScript file and a startup script. I have a C# code for this purpose.
i am not sure how to use the C# code. i was told the C# code just needs to be compiled into an assembly and deployed to the SharePoint server. however i dont quite know how can i do that.
( In case required, Reference to what i am trying to do is at this url )
any help appreciated .

In article you see that "feature" file contains
ControlAssembly="SharePointSolutionPack, Version=1.0.0.0, Culture=neutral, PublicKeyToken=4a7cd02bdf107f7a"
ControlClass="Motion10.SharePoint2007.SelectItemsAction"
That means the code goes inside class SelectItemsAction within Motion10.SharePoint2007 namespace.
SharePointSolutionPack is name of Dll file, which, when compiled, you copy to C:\Windows\assembly
However you must also copy feature defintion to (default location): C:\Program Files\Common Files\microsoft shared\Web Server Extensions\12\TEMPLATE\FEATURES
A helpful resource for You
Anyway, what i wrote is not very helpful because i'm not going into details. See this step-by-step example on creating sharepoint button (exactly what you need) that uses Visual Studio extension that helps you develop features and deploy them (without copy-pasting i meantioned above). (You'll learn how to create features with that article)
It is important to learn about sharepoint features, because before i understood how to create features, it was hard to do anything in sharepoint (couldn't understand sharepoint articles, when i saw code, all the time question pops up - where do i put that code?).
Good luck!

Here is a nice walkthrough. Hope it will help you out mate.
Deploy MSDN
Walkthrough: Creating a Webpart

Related

How to create an installation file for a document-level VSTO template?

This is hardly the first time this question has been asked, but there are no completely satisfactory answers that have been presented, and nearly ALL of them rely upon Microsoft's error-laden developer documentation.
After creating a vb.net VSTO Excel Template project using Visual Studio 2019 with Office 2016 and porting exiting VBA code to vb.net, I have run into a brick wall. I was able to convert the code to vb.net without too much trouble, and thanks to the .net libraries, I was able to include additional functionality that before was impossible with VBA (e.g. Action Panel menus, etc.). But now I cannot distribute the solution to my employees because I cannot create a setup file that will allow the template code to run correctly when the resulting document is saved to any location other than where it was first installed.
I have tried using the supposedly simple ClickOnce method. I have tried the Windows Installer method. We don't have a Sharepoint server (we are a small company) and I don't want to learn how to create one. I have followed the examples at
https://learn.microsoft.com/en-us/visualstudio/vsto/deploying-an-office-solution-by-using-windows-installer?view=vs-2019
and
https://learn.microsoft.com/en-us/visualstudio/vsto/deploying-an-office-solution-by-using-clickonce?view=vs-2019
and
https://learn.microsoft.com/en-us/visualstudio/vsto/deploying-a-vsto-solution-by-using-windows-installer?view=vs-2019#to-build-the-setup-project
and several other Microsoft Visual Studio VSTO instructional articles to no avail. I still cannot get the resulting template file to reference the necessary libraries when the template is moved or saved to any location on a user's computer other than its original install folder. This pretty much makes the solution useless to me. You would think something this important to so many VBA users would be a priority to Microsoft, but it clearly is not. Microsoft refuses to fix/update its documentation, and it ignores vb.net like Microsoft's own policies had nothing to do with why so many of us use it.
I would post my code, but I have no idea what code, in what has now become a rather complicated solution, is causing the problem. My only clue is the error message, which appears whenever the Excel workbook is saved somewhere else and states that "my solution".vsto could not be downloaded because Office is looking under where the template is now stored rather than the original installation directory.

Sharepoint Visual Web Part does not have a .cs file

I am trying to create a visual web part that has some properties associated with it so that I can use them as settings for the web part. I am trying to follow this tutorial however whenever I create a new "Visual Web Part" project it does not create the .cs file that they refer to in the tutorial.
Instead it creates the following:
Elements.xml
WebpartName.ascx
WebpartName.ascx.cs
WebpartName.ascx.g.cs
WebpartName.webpart
I am guessing that this is related to the SDK that I have installed:
Microsoft SharePoint 2010 SDK - version 14.0.4763.1086
Am I doing something wrong or should I try to get a different version of the SDK or is there a way that I can introduce webpart properties using this type of file structure? All of the examples I have seen thus far refer to the "WebpartName.cs" file.
Yes, you are right that Sharepoint 2013 Visual Web Part does not have a .cs file, but you can still add custom properties to the visual webpart using the .ascx.cs file.
Please refer the attached link for detailed steps:
http://www.ashokraja.me/articles/How-to-create-a-custom-property-and-set-a-default-value-in-a-SharePoint-2013-Visual-WebPart
Regards,
Deepali

SharePoint 2010 VS development: Intellisense for ASPX files

I'm using Visual Studio 2010 to develop a SharePoint Server 2010 solution. Part of this includes custom Page Layouts, but when editing them, intellisense is completely broken, since Visual Studio doesn't appear to know how to handle them. Here's what I've done:
Created a new blank solution
Right-clicked on the solution and created a new "Empty SharePoint Project"
Right-clicked on the project and created a new "Module"
Renamed sample.txt to MyPageLayout.aspx or created a new ASPX Web Form
At this point, intellisense for the new Page Layout is broken. It gets even worse with tools like ReSharper installed. Also, things like "Format Document" will break the Page Layout (by for example changing asp:Content to asp:content)
What I've tried to get intellisense working:
Added a Web.config from a standard Web Application Project to the root of the SharePoint Project - made no difference.
Added the ProjectGuid for a Web Application Project to the SharePoint project file - broke the project.
Is there any way to get intellisense, and the rest of the support Visual Studio can offer for Web Forms, available when developing SharePoint 2010 Page Layouts?
I have followed your post to some extent.
Using VS2010 (On an x64 machine)
Create a blank SharePoint solution. (this properly combines your #1 & #2)
Add a module (in SharePoint a module is like a folder or resource container)
added a new class to the module (intellisense present)
Added a new webpart to the module (intellisense present)
added a user control to the project designer works and (intellisense present)
I believe that you should consider creating true server or visual web parts. This will have a harder learning curve but will pay with dividends in the future. You will be able to package and deploy your solution again or to another server/farm. Aspx pages can be added and manipulated by the dreaded SharePoint designer. In 2010 the theory is that those designer mods can be packaged and deployed.
I work in this environment every day and the best advice I can give is to embrace the SP object model and do 'it' the sharepoint way. Don't try to force SP to be something its not. :)
This is probably not the solution you are looking for but it's the best thing I found for SharePoint development.
In your solution, create 2 projects :
1 SharePoint Project (empty or not)
1 ASP.NET web application project
Develop all your UI (aspx pages, ascx controls, etc.) in your ASP.NET project and create post-build steps that will copy the pages and controls to the appropriate folders in your SharePoint solution.
That way, you will benefit from all the features of web development in visual studio and it will be very easy to deploy as well. It is a bit of a time investment at first, but it is well worth it if you have any considerable amount of logic to implement in your aspx pages.
This blog post documents what you need to do.
you can add an intellsense to pagelayouts by closing the page and simply reopen it from
file->openfile->your file page layout path
Or you can directly "Right Click" on the file you want to open from the Solution explorer and then select "Open" : you'll get the Intellisense !

SharePoint 2010 - Creating a custom document library template

I'm trying to figure out if it is possible to create a custom document library template for SharePoint 2010. When a user clicks on the Libraries link on the quick launch menu of a new SharePoint site, and then clicks the Create button, the Create dialog is launched.
I know this dialog window hosts a Silverlight control, but obviously there is a way to create custom template types in this window. There is even a category that is called Blank & Custom. I've tried copying and modifying the DocumentLibrary feature located in the following location - C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\14\TEMPLATE\FEATURES, but that didn't seem to work.
Thanks for reading, I'm sure the answer is obvious but I've been stumbling over Google and MSDN all morning trying to figure this out but I haven't had any luck.
Well, unfortunately the answer is not that obvious. You'll have to create a new List Definition (a document library is actually a list). For that there are several ways, but as a developer, I guess the most common way is to do that through Visual Studio.
A basic tutorial that will guide you through the steps can be found here:
http://msdn.microsoft.com/en-us/library/ms466023.aspx
After you deploy your solution, a new list template (or document library, depending what you created) will show up in the dialog.
Yes, it is not that obvious at all.
Most of the Microsoft documentation is now based on using Visual Studio 2010 and are more focused on the lists than on the document libraries.
By the way, as told by Erwin, document libraries in SharePoint 2010 seems to have become lists, but the lack of documentation regarding the creation of custom lists remains anyway, so after having perform some successful trials I have decided to publish a step by step guide.
Sharepoint 2010 custom ducoment library

Access SharePoint objects from Delphi

We need to read and write the objects in SharePoint, such as the appointments (events) in SharePoint, from Delphi, what's the best/easiest way to do it? Any advises are appreciated! Thank you.
If you are able to use .NET references in Delphi and can develop on a SharePoint server then use the SharePoint Object Model. This is the most powerful way of working with SharePoint. Add a reference to C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\12\ISAPI\Microsoft.SharePoint.dll. The object model has its pain points to be aware of however and can have a bit of a steep learning curve in some areas. Take note of the need to dispose of partially unmanaged objects such as SPSite and SPWeb if you take this route.
Alternatively use the SharePoint web services. These are quite simple and work well once you get their syntax correct. If your code cannot be deployed to the SharePoint server then they are your only option. The downside is that they are significantly reduced in functionality compared to the object model. You will certainly run up against this sooner or later which is why I recommend starting with the object model if possible.
The usual way is to refer to the MSDN documentation at http://msdn.microsoft.com/en-us/library/bb931736.aspx.
In Delphi, you then go to Component menu, Import component and then choose type library. Microsoft Sharepoint should be listed, but if it is not you can browse to find the client library. For Office 2007, that folder is C:\Program Files\Microsoft Office\Office12\OWSSUPP.DLL.
This will create a unit that contains definitions for all the Sharepoint interfaces and CoClasses. You would typically start of with one of the CoClasses, like CoMyStuff.Create to create an object that implements the MyStuff interface. Then follow the MSDN documentation to do what you want.

Resources