How can i access my custom webpart in sharepoint foundation 2010? - sharepoint

So i just started trying to develop a simple webpart today for a sharepoint foundation i put on a virtual machine. I have no previous experience with sharepoint whatsoever.
As i cant run a sharepoint 2010 on my local machine for dev purposes i followed advices in this thread http://social.technet.microsoft.com/Forums/en/sharepoint2010programming/thread/cda807f6-4edf-4efc-8e9b-4d446356c8ae to able to actually develop something (just the registry bit).
I created the simple test web part (writes out "hi"), uploaded it to virtual machine, added it with add-spsolution and install-spsolution in powershell with success. When i do get-solution through powershell on my webpart it says deployed = true.
What am i missing from here to get it to actually show up somewhere in the web interface so i can add it to a page?
Cheers

You need to go into site settings and activate the feature. If its already activated edit the page > Insert WebPart > Look under Custom to find your webpart.
HTH

Related

SharePoint 2013 Dynamic Data on all pages

If I have a requirement of displaying the a content on all the pages inside a header, Whats the best way to do that in an SharePoint 2013?
I am working on a master page that will be using the design manager and there is possibility of using the same master page in the SharePoint online too. The reason why I want to know what is the best way, when I use this same master page in SharePoint online I would like avoid redoing that entire coding for getting a dynamic data from the web service.
Several ways that I have been planning is below
- User control method
- Web part method, but requires server side coding which I doubt can used in online version
This is a complete dynamic data that will be retrieved by a web service and no internal SharePoint data be used.
Thanks for reading
Deepak
If its possible to consume web-service using jQuery/Ajax call you can go with that
Or else if you want to use c#, might need to go with provider hosted app feature (sharepoint 2013)
You can create a Visual Web Part for SharePoint 2013 Online.
Your web part will be contained in a Sandbox Solution which you will develop locally. Once development is complete you will upload the Solution Package created by Visual Studio to SharePoint Online.
https://sharepoint.stackexchange.com/questions/80164/create-visual-webpart-for-sharepoint-online
http://sharepoint-community.net/profiles/blogs/sharepoint-online-2013-web-part-deployment

Do Webparts get added to the the automatically on deployment?

I created a webpart in a sharepoint, tried googiling how the webpart would need to be added to the webpart gallery but couldn't find a good answer or a "how to" how it is done programatically through the activateFeature?. is there an online source which I can follow?
I am not fully clear on your question. Going on an assumption you have developed a webpart using Visual Studio (say 2010 or 2012), then the addition of your webpart to the webpart gallery of your site collection will be taken care of when the solution (the compiled WSP) is deployed (whether you do it through Visual Studio deploy commands, PowerShell etc.) to your target SharePoint instance. If this is not your question, then let us know.

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.

Allow Content Editor Web Part

Using SharePoint 2007, how could I allow the adding of CEWP's to the selection menu of an "Add a Web Part" dialog while in Edit Page mode? As of the moment, I can only add Announcements, Calendar, Links, Shared Documents, Tasks but I do not have the ability to add a CEWP. I have full access to the site.
At Site Settings > Site Features > Site Collection Features, you will want to have the Office SharePoint Server Publishing Infrastructure set to active.
Then, on the site, go to Site Settings > Site Features, and activate the Office SharePoint Server Publishing feature. You should then be able to add the content editor web part to the site.
Quite often I see SharePoint 2010 websites without the Content Editor webpart (MSContentEditor.dwp)
To enable this web part you need to activate the BasicWebParts feature on that site. I did not find an option to do this by the web site admin; you can enable the feature however by using SharePoint powershell.
Execute the following statement in the SharePoint Powershell and the Content editor web part will be added to your site
Enable-SPFeature 00bfea71-1c5e-4a24-b310-ba51c3eb7a57 -Url [SharepointSiteUrl]
To get the SharePoint site url just run
Get-SPSite
Gertjanvanmontfooort blog
I ran into a similar issue in SharePoint 2010, but I couldn't see other webparts due to my user permissions on the Site Collection. After getting "Restricted Read" rights on the Site Collection I could see all of the different WebParts.
Here is what helped me fo Sharepoint 2013 Online (Office365):
http://answers.microsoft.com/en-us/msoffice/forum/msoffice_o365admin-mso_manage/problems-opening-a-site-from-sharepoint-designer/d1e71427-be3f-4ea7-be3b-8ba6b64af76c?page=2&auth=1
Basically, I had to set flag DenyAddAndCustomizePages to 0 using sharepoint power shell.
Moreover, from time to time I had to reset the flag to 0 as the online sharepoint seems to reset it to deafult 1.
After trying all the above, and other proposed solutions, my eventual success was through PowerShell script. Admittedly I did check that Custom Scripts was permitted and I did have to Activate the two "SharePoint Server Publishing" features described above, but as I am using a sub-site I presmume something else must have been messed up. In the end the following script allowed me to see the Content Editor option when adding a Web Part:
SET-SPOSite -DenyAddandCustomizePages 0
The full article can be found here:
https://answers.microsoft.com/en-us/msoffice/forum/msoffice_o365admin-mso_manage/problems-opening-a-site-from-sharepoint-designer/d1e71427-be3f-4ea7-be3b-8ba6b64af76c?page=2&auth=1

SharePoint development nightmares

I thought I'd give SharePoint development a go, to broaden my understanding of Microsoft technologies and ran into a situation I refuse to understand.
I have a new web application created: http://localhost:11523 and set up the site collection as required. I can browse to the web site fine, without any issues, but now I want to start developing against this, using the object model.
Right, so after I struggled with SPSite site = new SPSite("http://localhost:11523"); I figured that I'm not running VS2008 in elevated permissions, so restarting VS I finally got one step further.
Whenever I step into my code, I get:
The Web application at
http://localhost:11523/ could not be
found.
I've Googled this without luck. The application is most definitely there, I can browse it, add web parts and go mad. I just can't seem to connect to it via Visual Studio.
Any ideas would be great.
EDIT
I thought I'd isolate my method, called "GetListFromSharePoint(string name)" into a test method (nUnit Framework) and to my surprise returned 9 entries from the list, as expected. When I dumped the method back into my web application (not SharePoint, trying to test the Composite Control through a normal Web site), and run into the mentioned problem.
This is in SharePoint 2007, and I'm developing on the same machine onto which SharePoint 2007 is installed.
This approach used to work, for some reason, I just can't get it to recognize SharePoint. The test stubs work find, just not the web application.
Edit 2
So there where a couple of things I "missed", which kind of solved the problem by itself.
Firstly, I was developing on a x64 Windows 2008 box, thus SharePoint 2007 was running in x64 mode. Cassini, turns out, is 32bit regardless of the platform you run it on, which caused some compiler bugs (I did not have IA64 compilers installed). After installing this, I figured out that the default web site (localhost:80) had been disabled by SharePoint.
Renabling the default web site, allowed me to create my web application as a virtual directory against it, which allowed my debugger compiler to run in x64.
My next challenge was access permissions. Because any new virtual directory on port 80 is assigned to the default application pool, is it assumed that the user does not have the right permissions, so I had to change my web application to run under my SharePoint web application's application pool.
The last thing I had to do was run my SharePoint code with elevated permissions.
Working like a charm :D
Note! Enable debug on your SharePoint web application....
Thanks,
Eric
(You have not specified version - assuming SharePoint 2010).
You need to decide what object model you want to use:
client (to be able to access the server from any other machine)
server (the one that you are trying now, can only be run locally).
Most likley reasons your code not work:
using "localhost" instead of ""computer name" in the Url. (I believe it is the reason.)
you are running your code not on the same machine as the SharePoint
you are running code under non-admin account
Check out how sites collections are configured in "Central Administration" site - urls associated with each site collection are listed there - make sure you are using correct one.
You can also try enumerating all site collections in SPWebApplication (http://msdn.microsoft.com/en-us/library/microsoft.sharepoint.administration.spwebapplication.sites.aspx) to start expiriments.
I dont think the SPSite connect through the IIS, and if SharePoint isn't set up to respond to localhost (done in the Central Administration) you wont be able to connect to that url. IIS works a bit different here since it relays the signals to "localhost" to the "web application instance".
Start by checking in your SharePoint Central Administration. Go to "Configure alternate access mappings" in the "System Settings" section. Here you have your SharePoint instances, there are three properties which you can see directly in the list; 'Internal URL', 'Zone' and 'Public URL for Zone'.
If the Internal URL isn't set to Localhost you wont be able to use that connection you suggested. It bay be improper to change this to another url as well, so simply try to set your SPSite site = new SPSite("http://yourinternalurl:11523"); to whatever's in that box! :)
Cheers

Resources